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.

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

See original GitHub issue

Issue Description

When I run TypeOrm against MySql 8.0.22 under Docker Compose I get the following error:

Client does not support authentication protocol requested by server; consider upgrading MySQL client'

However, when I use MySql 5.7 all is well

Here is the actual error I get went I run the index.ts that is generated using typeorm init

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    at Handshake.Sequence._packetToError (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
    at Handshake.ErrorPacket (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
    at Protocol._parsePacket (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/Connection.js:88:28)
    at Socket.<anonymous> (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/Connection.js:526:10)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:483:12)
    --------------------
    at Protocol._enqueue (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Protocol.handshake (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/protocol/Protocol.js:51:23)
    at PoolConnection.connect (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/Connection.js:116:18)
    at Pool.getConnection (/Users/reselbob/Documents/source-tree/cory/node_modules/mysql/lib/Pool.js:48:16)
    at /Users/reselbob/Documents/source-tree/cory/src/driver/mysql/MysqlDriver.ts:894:18
    at new Promise (<anonymous>)
    at MysqlDriver.createPool (/Users/reselbob/Documents/source-tree/cory/src/driver/mysql/MysqlDriver.ts:891:16)
    at MysqlDriver.<anonymous> (/Users/reselbob/Documents/source-tree/cory/src/driver/mysql/MysqlDriver.ts:344:36)
    at step (/Users/reselbob/Documents/source-tree/cory/node_modules/tslib/tslib.js:141:27)
    at Object.next (/Users/reselbob/Documents/source-tree/cory/node_modules/tslib/tslib.js:122:57) {
  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
}

Here is my package.json file:

{
  "name": "cory",
  "version": "0.0.1",
  "description": "A WIP project for implementing objective core capabilities analysis and rating of software services",
  "main": "server.js",
  "scripts": {
    "start": "ts-node ./index.ts",
    "start_server": "ts-node ./server.ts",
    "test": "mocha -r ts-node/register tests/**/*_test.ts --exit",
    "build": "tsc",
    "seed": "mocha -r ts-node/register utilities/index.ts",
    "mysql": "ts-node src/mysql/index.ts"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/reselbobasg/cory.git"
  },
  "author": "Bob Reselman <bob@devops.com>",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/reselbobasg/cory/issues"
  },
  "homepage": "https://github.com/reselbobasg/cory#readme",
  "dependencies": {
    "@types/graphql-date": "^1.0.5",
    "apollo-server-express": "^2.17.0",
    "compression": "^1.7.4",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "graphql": "^15.3.0",
    "graphql-date": "^1.0.3",
    "graphql-tools": "^6.1.0",
    "http": "0.0.1-security",
    "mysql": "^2.18.1",
    "ncp": "^2.0.0",
    "reflect-metadata": "^0.1.13",
    "type-graphql": "^1.0.0",
    "typeorm": "^0.2.28",
    "typescript": "^3.9.7"
  },
  "devDependencies": {
    "@types/body-parser": "^1.17.1",
    "@types/chai": "^4.2.12",
    "@types/compression": "^1.7.0",
    "@types/express": "^4.17.7",
    "@types/faker": "^4.1.12",
    "@types/graphql": "^14.5.0",
    "@types/graphql-depth-limit": "^1.1.2",
    "@types/mocha": "^8.0.0",
    "@types/node": "^14.14.5",
    "chai": "^4.2.0",
    "faker": "^4.1.0",
    "graphql-depth-limit": "^1.1.0",
    "graphql-import": "^1.0.2",
    "graphql-import-node": "0.0.4",
    "graphql-request": "^3.0.0",
    "mocha": "^8.0.1",
    "ts-node": "^8.10.2"
  }
}

Here is the docker-compose file.

version: '3.3'
services:
  db:
    image: mysql:latest
    restart: always
    environment:
      MYSQL_DATABASE: 'db'
      # So you don't have to use root, but you can if you like
      MYSQL_USER: 'user'
      # You can use whatever password you like
      MYSQL_PASSWORD: 'password'
      # Password for root access
      MYSQL_ROOT_PASSWORD: 'password'
    ports:
      # <Port exposed> : < MySQL Port running inside container>
      - '3306:3306'
    expose:
      # Opens port 3306 on the container
      - '3306'
      # Where our data will be persisted
    volumes:
      - "./config/my.conf:/etc/mysql/conf.d/config-file.cnf"
      - "./data:/var/lib/mysql:rw"

By the way, I clear out the data and config directories between runs.

Any help will be sincerely appreciated.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ajparrahcommented, Jun 1, 2021

I was getting this message. I tried to install mysql2 instead of mysql and it works.

2reactions
bmcilw1commented, Jan 5, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Client does not support authentication protocol requested ...
1) Type MySQL in the windows search bar · 2) Open the MySQL Windows Installer - Community · 3) Look for "MySQL server"...
Read more >
MYSQL: Client does not support authentication protocol…
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client.
Read more >
B.3.2.4 Client does not support authentication protocol
The Client does not support authentication protocol error also can occur if multiple versions of MySQL are installed but client programs are dynamically...
Read more >
Client does not support authentication protocol requested ...
What is actually happening? it gives ERROR: Client does not support authentication protocol requested by server; consider upgrading MySQL client.
Read more >
How to fix "Client does not support authentication protocol ...
How to fix "Client does not support authentication protocol requested by server; consider upgrading MySQL client"? · If the . · Extract the...
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