ER_NOT_SUPPORTED_AUTH_MODE after upgrade
See original GitHub issueIssue type:
[ ] question [x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
I’m deploying my code to Azure using docker cloud. Before upgrading TypeOrm, this was smooth sailing. After upgrading TypeORM from 0.1.21 to 0.2.5, I get this obscure error message:
typeorm migration:run
Error during migration run:
{ Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
at Handshake.Sequence._packetToError (/usr/src/app/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
at Handshake.ErrorPacket (/usr/src/app/node_modules/mysql/lib/protocol/sequences/Handshake.js:130:18)
at Protocol._parsePacket (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:279:23)
at Parser.write (/usr/src/app/node_modules/mysql/lib/protocol/Parser.js:76:12)
at Protocol.write (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/usr/src/app/node_modules/mysql/lib/Connection.js:103:28)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
--------------------
at Protocol._enqueue (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:145:48)
at Protocol.handshake (/usr/src/app/node_modules/mysql/lib/protocol/Protocol.js:52:23)
at PoolConnection.connect (/usr/src/app/node_modules/mysql/lib/Connection.js:130:18)
at Pool.getConnection (/usr/src/app/node_modules/mysql/lib/Pool.js:48:16)
at /usr/src/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:694:18
at new Promise (<anonymous>)
at MysqlDriver.createPool (/usr/src/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:691:16)
at MysqlDriver.<anonymous> (/usr/src/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:250:51)
at step (/usr/src/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:32:23)
at Object.next (/usr/src/app/node_modules/typeorm/driver/mysql/MysqlDriver.js:13:53)
code: 'ER_NOT_SUPPORTED_AUTH_MODE',
errno: 1251,
sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client',
sqlState: '08004',
fatal: true }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! migrations:run: `typeorm migration:run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the migrations:run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
My working (before typeorm upgrade) stack file is this:
db:
image: 'mysql:latest'
restart: on-failure
environment:
- MYSQL_DATABASE=myDB
- MYSQL_PASSWORD=password
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=myuser
volumes:
- '/usr/src/app/data:/var/lib/mysql'
client:
image: 'dockerhubuser/client:latest'
autodestroy: on-success
autoredeploy: true
restart: on-failure
environment:
- DATABASE_HOST=db
- NODE_ENV=production
links:
- db
volumes:
- '/usr/src/app/log:/usr/src/app/log'
- '/usr/src/app/media:/usr/src/app/media'
nginx:
image: 'dockerhubuser/nginx'
autodestroy: on-success
autoredeploy: true
restart: on-failure
environment:
- TZ=UTC
links:
- client
ports:
- '80:80'
- '443:443'
volumes:
- '/usr/src/app/cert/ssl:/etc/nginx/ssl'
My ormconfig.json
[
{
"name": "default",
"environment": "production",
"type": "mysql",
"host": "db",
"port": 3306,
"username": "myuser",
"password": "password",
"database": "myDB",
"logging": "error",
"entities": [
"dist/model/*.js"
],
"migrations": [
"dist/migrations/*.js"
],
"cli": {
"migrationsDir": "src/server/migrations"
},
"synchronize": true
}
]
I’ve tried exposing the mysql container and connecting to it using mysql workbench works fine. I thought the volume containing the table files was corrupt, so I removed the data in the volume to get a clean start, but to no avail. The database was cleaned up, but typeorm migrations still cannot run.
Am I doing something wrong?
For reference, this is my repo: https://github.com/OysteinAmundsen/gymsystems
Issue Analytics
- State:
- Created 5 years ago
- Reactions:13
- Comments:28 (4 by maintainers)
Top GitHub Comments
I found a solution for docker.
--default-authentication-plugin=mysql_native_password
It was because
typeorm
usemysql
inside,mysql2
dose not has this problemYou can change your package.json
to