Mysql: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

Created on 12 May 2018  路  1Comment  路  Source: mysqljs/mysql

Using:

  • docker hub mysql latest: v8.0.11
  • Latest Mysql client from npm: v2.15.0
  • Node 8.11.1
  • Connecting through TypeORM: v0.2.5

I'm getting this error, but I have done nothing to tweak the defaults anywhere.

Error:

Error during schema synchronization:
 { 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! [email protected] db:sync: `typeorm schema:sync && yarn migrations:run`
 npm ERR! Exit status 1
 npm ERR! 
 npm ERR! Failed at the [email protected] db:sync script.
 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

docker-stack.yml

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'

I tried switching to insecureAuth : true as suggested by https://stackoverflow.com/questions/44946270/er-not-supported-auth-mode-mysql-server, but this gave me the same error.

I looked at #1574 , but the solution here returns:
ERROR 1396 (HY000): Operation ALTER USER failed for 'system'@'localhost'.

Not sure if #1507 applies here, as I do not think I'm using auth_socket.

Perhaps #2001 is related, but this does not provide any solutions.

I tried to downgrade Typeorm, as this error first surfaced after a typeorm upgrade, but nothing changed. Same error. My only suspect now, is the docker image for mysql perhaps changed at the same time, giving me an upgraded mysql version.

What can I do?

duplicate

Most helpful comment

You are using MySql 8 which the default auth is not yet supported. We're working to get it added currently. Duplicate of #2002

>All comments

You are using MySql 8 which the default auth is not yet supported. We're working to get it added currently. Duplicate of #2002

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johnrc picture johnrc  路  3Comments

hohozhao picture hohozhao  路  4Comments

nanom1t picture nanom1t  路  3Comments

whatthehell232 picture whatthehell232  路  3Comments

macias picture macias  路  3Comments