数据库-连接不可用。 Prisma / Docker到MySQL

时间:2019-05-24 10:52:22

标签: mysql docker docker-compose xampp prisma

我按照入门教程为MySQL(在xampp上)数据库设置Prisma:1.33。 Prisma不在http://localhost:4466/上运行。 我看到该容器每隔几秒钟就会重新启动。

我已多次停止容器,或重置了Docker。 我还尝试在bind-address = ::

上的my.ini中进行设置

命令:

$ docker ps -a
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS                        PORTS               NAMES
7677a6a087f4        prismagraphql/prisma:1.33   "/bin/sh -c /app/sta…"   17 minutes ago      Restarting (1) 1 second ago                       existing_prisma_1

MySQL:

$ mysql --version
G:\xampp\mysql\bin\mysql.exe  Ver 15.1 Distrib 10.1.40-MariaDB, for Win64 (AMD64)

docker-compose(我更改了database而不是schema):

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.33
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
        # managementApiSecret: my-secret
        databases:
          default:
            connector: mysql
            host: localhost
            database: test
            user: root
            password: sth
            rawAccess: true
            port: '3306'
            migrations: false

日志:

prisma_1  | No log level set, defaulting to INFO.
prisma_1  | [INFO] {} - Started.
prisma_1  | [INFO] {} - Started.
prisma_1  | Exception in thread "main" java.sql.SQLTransientConnectionException: database - Connection is not available, request timed out after 5001ms.
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)
prisma_1  | Caused by: java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=localhost)(port=3306)(type=master) : Connection refused (Connection refused)
prisma_1  |     at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:161)
prisma_1  |     at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.connException(ExceptionMapper.java:79)
prisma_1  |     at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1040)
prisma_1  |     at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:490)
prisma_1  |     at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:144)
prisma_1  |     at org.mariadb.jdbc.Driver.connect(Driver.java:90)
prisma_1  |     at slick.jdbc.DriverDataSource.getConnection(DriverDataSource.scala:101)
prisma_1  |     at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:341)
prisma_1  |     at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:193)
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:430)
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool.access$500(HikariPool.java:64)
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:570)
prisma_1  |     at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:563)
prisma_1  |     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
prisma_1  |     ... 3 more
prisma_1  | Caused by: java.net.ConnectException: Connection refused (Connection refused)
prisma_1  |     at java.net.PlainSocketImpl.socketConnect(Native Method)
prisma_1  |     at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
prisma_1  |     at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
prisma_1  |     at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
prisma_1  |     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
prisma_1  |     at java.net.Socket.connect(Socket.java:589)
prisma_1  |     at java.net.Socket.connect(Socket.java:538)
prisma_1  |     at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connect(AbstractConnectProtocol.java:398)
prisma_1  |     at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1032)
prisma_1  |     ... 14 more

0 个答案:

没有答案