#Docker Connection Error via TypeORM
13 messages · Page 1 of 1 (latest)
Error:
[Nest] 87868 - 10/12/2022, 2:17:03 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
docker-compose.yml
version: '3.8'
services:
dev-db:
image: mysql
restart: always
ports:
- '3306:3306'
expose:
- '3306'
environment:
MYSQL_ROOT_PASSWORD: dev
MYSQL_DATABASE: dev-db
MYSQL_USER: dev
MYSQL_PASSWORD: dev
config.dev.env
# MySQL DB Connection Details
DB_HOST='localhost'
DB_PORT=3306
DB_USERNAME='dev'
DB_PASSWORD='dev'
DB_NAME='dev-db'
The "mysql" image is a fresh install, and the docker desktop is running with the container.
try to use the root user instead of dev since you're using it for local development
which package you installed for mysql?
Will give that a go tomorrow and see how it works.
npm install mysql
try using the mysql2 package (npm install mysql2)
I'll give it a shot. It didn't work the first few times I tried to use it in other projects. Will try again though.
👍
There was a change in MySQL's default authentication method in v8, and some libraries have not yet landed the support: https://github.com/mysqljs/mysql/pull/2233
You can also change the auth method back for your docker db: https://stackoverflow.com/a/59228365/2078771
I believe this will need you to clear the docker volumes too, since your DB will already be initialised with the newer option.
destructive: docker dompose down --volumes