Kitura/SwiftKueryMySQL

MySQLConnection not working

japanese-goblinn opened this issue · 0 comments

So problem is that I can't connect to my database in docket container. I've tested connection with Workbench and in python and everything was working, but not in swift 😭

My docket-compose file

version: '3.3'
services:
  byTickets-database:
    image: mysql:latest
    volumes: 
      - "./.mysql-data/db:/var/lib/mysql"
    environment:
      MYSQL_DATABASE: byTickets
      MYSQL_ROOT_PASSWORD: root
    ports:
      - "3308:3306"

My connection code

let connection = MySQLConnection(
    host: "127.0.0.1",
    user: "root",
    password: "root",
    port: 3308,
    reconnect: true
)
connection.connect() { res in
    guard res.success else {
        print(res.asError?.localizedDescription as Any)
        return
    }
    connection.execute("SELECT @@version") { res in
        print(res)
    }
}

Error

"The operation couldn’t be completed. (SwiftKuery.QueryError error 0.)"