Prisma 1 Forum

Connecting to a local database

Hi where can I find information to setup and use Prisma sever with my local installed database?

I’m using Linux and have MySql, Postgresql and Mongodb installed. Where can I find documented information to connect to any one of these databases without using a Docker image?

I have tired “prisma deploy” and used the menu option to connect to a running instance of MySql and it refuses to connect:

 prisma deploy
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? MySQL
? Does your database contain existing data? No
? Enter database host localhost
? Enter database port 3306
? Enter database user devguy
? Enter database password <xxxx>

Connecting to database !
 ▸    Could not connect to database. Connection terminated unexpectedly

Get in touch if you need help:
To get more detailed output, run $ export DEBUG="*"
TypeError: Cannot read property 'name' of undefined
    at Socket.<anonymous> (/home/devguy/.nvm/versions/node/v10.14.1/lib/node_modules/prisma/node_modules/pg/lib/connection.js:120:27)
    at Socket.emit (events.js:182:13)
    at Socket.EventEmitter.emit (domain.js:460:23)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

I would rather just know how to handcraft the configuration files to selected my database of choice.

I can connect to the database from the terminal:

$ mysql -u devguv -p -h localhost -P 3306
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 8.0.13 MySQL Community Server - GPL

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version();
| version() |
| 8.0.13    |
1 row in set (0.00 sec)

To connect a docker image with localhost you need to set the docker-compose.yml by adding network_mode: “host” like this:

version: '3'
    image: prismagraphql/prisma:1.14
    restart: always
    - "4466:4466"
    network_mode: "host"
        managementApiSecret: my-server-secret-123
        port: 4466
            connector: mysql  # or `postgres`
            migrations: true
            host: db
            port: 3306        # or `5432` for `postgres`
            user: root
            password: prisma

Hope this helps