plz, help me!
# prisma-client
d
plz, help me!
h
which version cli are you using?
d
danyui-MacBookPro:danystagram2 dany$ prisma -v prisma/1.28.3 (darwin-x64) node-v11.10.1
h
can you please try version 1.26.3
d
ok i'll try it
is it imposible use localhost:3306 ? i can connect by gui tool, but i got a message
Could not connect to database. Connection terminated unexpectedly
in 1.26.3 version
h
weird, do you have a password set for the root user
d
yes, i set a simple password
h
try 127.0.0.1 instead of localhost
d
already tried.. 2 case all fail.
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 127.0.0.1 ? Enter database port 3306 ? Enter database user root ? Enter database password rhkr1636
h
ok, then you can try a manual setup,
create a new folder
and create a docker-compose.yml, datamodel.prisma and prisma.yml file
paste this in docker-compose.yml file
d
ok, current status
:prismatest dany$ ls datamodel.prisma docker-compose.yml prisma.yml
h
ok
paste this in docker-compose.yml file
Copy code
version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.28
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        databases:
          default:
            connector: mysql
            host: mysql
            port: 3306
            user: root
            password: prisma
            migrations: true
paste this in datamodel.prisma file
Copy code
type User{
  id: ID! @unique
  name: String
}
and paste this in prisma.yml
d
ok.
h
Copy code
endpoint: <http://localhost:4466>
datamodel: datamodel.prisma
after that run docker-compose up -d
d
yapp i did it
h
changed password
in the file?
ok then try running prisma deploy
d
i already not use setup docker. before, i will install docker-compose
h
ok, you can also use demo server for quick use but that will not give you database access
d
yap, i had test demo. it is good but i want use query in database, too 🙂
sorry
Could not connect to server at http://localhost:4466. Please check if your â–¸ server is running.
what mean this port?
h
run docker-compose logs
tell me what you see in the logs
d
oh..
Exception in thread "main" java.sql.SQLTransientConnectionException: database - Connection is not available, request timed out after 5000ms. prisma_1 | at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:548) prisma_1 | at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:186) prisma_1 | at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:145) prisma_1 | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:83) prisma_1 | at slick.jdbc.hikaricp.HikariCPJdbcDataSource.createConnection(HikariCPJdbcDataSource.scala:14) prisma_1 | at slick.jdbc.JdbcBackend$BaseSession.<init>(JdbcBackend.scala:453) prisma_1 | at slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:46) prisma_1 | at slick.jdbc.JdbcBackend$DatabaseDef.createSession(JdbcBackend.scala:37) prisma_1 | at slick.basic.BasicBackend$DatabaseDef.acquireSession(BasicBackend.scala:249) prisma_1 | at slick.basic.BasicBackend$DatabaseDef.acquireSession$(BasicBackend.scala:248) prisma_1 | at slick.jdbc.JdbcBackend$DatabaseDef.acquireSession(JdbcBackend.scala:37) prisma_1 | at slick.basic.BasicBackend$DatabaseDef$$anon$2.run(BasicBackend.scala:274) prisma_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) prisma_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) prisma_1 | at java.lang.Thread.run(Thread.java:748)
may be connection fail
h
can you please try connecting again from the GUI
prisma is not able to establish a connection to your database
d
version: '3' services: prisma: image: prismagraphql/prisma:1.28 restart: always ports: - "4466:4466" environment: PRISMA_CONFIG: | port: 4466 databases: default: connector: mysql host: mysql port: 3306 user: root password: rhkr1636 migrations: true ~
is it right?
h
yup
You can also run a mysql instance inside docker
d
it success to connect by gui
h
and expose it on a port so that you can query it using your gui
I don't know with this means there is something wrong with your machine in regard of the MySQL installation. I can't help you without a reproduction
btw which version of mysql you are running
d
5.6
h
it should work but something is messed up in your machine and prisma can't connect to your instance
d
ok i will find other way, for example use cloud rdb..
thank you
h
yes, easiest will be to use mysql inside docker
I can help you with that
can you will be able to connect to it with a gui as well
ok, so to do that use this docker-compose now
d
it is very useful if i want use for side project,
but i have a plan for prod database
h
yes, in prod it will be fine.
cause you will use a RDS or something
d
it was helpful for me. thank you.
h
Copy code
version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.28
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        databases:
          default:
            connector: mysql
            host: mysql
            port: 3306
            user: root
            password: prisma
            migrations: true
  mysql:
    ports:
      - "3010:3306"
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: prisma
    volumes:
      - mysql:/var/lib/mysql
volumes:
  mysql:
even this setup can run there using a persistent volume claim that will persist the data.
wait
need to edit
you can paste this now
d
Should I open 4466 inbound port on my personal computer?
h
no need you should be able to access it in your machine
you have pasted this now?
d
ok i am retry compose
then,
danyui-MacBookPro:prismatest dany$ prisma deploy â–¸ Could not connect to server at http://localhost:4466. Please check if your server is running.
h
wait 5 secs
d
yup
h
container must be starting
check logs
see what it says now
should started on :4466
d
connector: mysql host: mysql port: 3306 user: root password: rhkr1636 migrations: true
host => 127.0.0.1?
may be connection fail
h
you changed the password?
dont do that
paste it as it is
Copy code
version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.28
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        databases:
          default:
            connector: mysql
            host: mysql
            port: 3306
            user: root
            password: prisma
            migrations: true
  mysql:
    ports:
      - "3010:3306"
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: prisma
    volumes:
      - mysql:/var/lib/mysql
volumes:
  mysql:
d
version: '3' services: prisma: image: prismagraphql/prisma:1.28 restart: always ports: - "4466:4466" environment: PRISMA_CONFIG: | port: 4466 databases: default: connector: mysql host: mysql port: 3306 user: root password: rhkr1636 migrations: true mysql: ports: - "3010:3306" image: mysql:5.7 restart: always environment: MYSQL_ROOT_PASSWORD: rhkr1636 volumes: - mysql:/var/lib/mysql volumes: mysql:
is it right?
oh sorry i had fault my sql version is 8.0.13
h
that explains it
prisma doesnt support mysql 8 yet
as the authentication method has changed
it will take some work to make it compatible but right now you can't use it
d
oh i got it .. sorry. i send to you wrong information
h
no problems
d
thank you.