lujakob/nestjs-realworld-example-app

TypeOrmModule: Unable to connect to the database

mhabsaoui opened this issue · 2 comments

Hi,
I am trying to make NestJs web-app to connect to a Mysql DB running in a docker container.

ormconfig.json :

{
  "type": "mysql",
  "host": "localhost",
  "port": 3306,
  "username": "root",
  "password": "rootpass",
  "database": "nestjsrealworld",
  "entities": ["src/**/**.entity{.ts,.js}"],
  "synchronize": true
}

The docker command I am using to run mysql container instance :
docker run --rm --name nest-mysql -p3306:3306 -e MYSQL_ROOT_PASSWORD=rootpass -e MYSQL_DATABASE=nestjsrealworld -d mysql

The problem I get is it cannot to DB :/

[Nest] 18963   - 2019-07-02 2:35 PM   [TypeOrmModule] Unable to connect to the database. Retrying (1)... +97ms
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

I have checked on the Mysql container logs it is ready for connections...

Thanks for your help.

Ok, I had to use a previous version mysql:5.7.26 to make it connect.

I'd keep this open, since upgrading this repo to newer mysql is a valid feature request.