question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ER_NOT_SUPPORTED_AUTH_MODE after upgrade

See original GitHub issue

Issue 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:closed
  • Created 5 years ago
  • Reactions:13
  • Comments:28 (4 by maintainers)

github_iconTop GitHub Comments

68reactions
can-cccommented, Jan 29, 2019

I found a solution for docker.

docker run --name some-mysql \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-d mysql \
--default-authentication-plugin=mysql_native_password

--default-authentication-plugin=mysql_native_password

61reactions
xianjiezhcommented, Jul 9, 2020

It was because typeorm use mysql inside, mysql2 dose not has this problem

You can change your package.json

mysql: "^2.18.1"

to

"mysql": "npm:mysql2@^2.1.0",
Read more comments on GitHub >

github_iconTop Results From Across the Web

ER_NOT_SUPPORTED_AUTH_...
"ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server. Consider upgrading MariaDB client." JS/SQL ...
Read more >
ER_NOT_SUPPORTED_AUTH_...
... ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client ...
Read more >
ER_NOT_SUPPORTED_AUTH_...
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client.
Read more >
ER_NOT_SUPPORTED_AUTH_...
"Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client".
Read more >
Error: ER_SUPPORTED_AUTH_MODE: Client does not ...
ER_SUPPORTED_AUTH_MODE is caused by your client attempting to use an authentication mode your server does not support.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found