Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ER_NOT_SUPPORTED_AUTH_MODE #109

Open
tony0511 opened this issue May 27, 2020 · 8 comments
Open

ER_NOT_SUPPORTED_AUTH_MODE #109

tony0511 opened this issue May 27, 2020 · 8 comments

Comments

@tony0511
Copy link

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

@chill117
Copy link
Owner

Can you provide more information?

  • Node version
  • express-mysql-session version
  • If you are creating your own MySQL connection, please provide:
    • The code that does this
    • The mysql module name and version number

@MichaelKohler
Copy link

Running into this as well:

  • Node 14 or 12 doesn't make a difference
  • express-mysql-session: 2.1.4
  • MySQL running in docker: mysql:8.0
  • express-session: 1.17.1

My connections to the database work from outside this library. Here's the config that gets passed to mysql.createPool. Host, user, password and database are the same params as I use in sequelize which works.

{
  host: 'localhost',
  user: 'admin',
  password: 'localdevelopment',
  database: 'sentencecollector',
  createDatabaseTable: true,
  endConnectionOnClose: true,
  clearExpired: true,
  checkExpirationInterval: 900000,
  expiration: 86400000,
  connectionLimit: 1,
  charset: 'utf8mb4_bin',
  schema: {
    tableName: 'sessions',
    columnNames: { session_id: 'session_id', expires: 'expires', data: 'data' }
  }
}

@babyoumine
Copy link

just query this in the mysql connection that you want to connect to or switch to mysql 5.something

ALTER USER 'YOUR USERNAME'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR PASSWORD'

flush privileges;

@babyoumine
Copy link

oh and if this doesnt work remove the @

@JoshMayberry
Copy link

JoshMayberry commented Oct 6, 2020

I am getting the same issue.
I have tried doing it with a user that uses mysql_native_password, but that is not making any difference.

I ended up making my own mysql connection like this:
image

@mdodge-ecgrow
Copy link

mdodge-ecgrow commented Dec 21, 2020

just query this in the mysql connection that you want to connect to or switch to mysql 5.something

ALTER USER 'YOUR USERNAME'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR PASSWORD'

flush privileges;

This actually worked for me!!! I ran it in MySQL Workbench and had to remove the @'localhos' part. After hours if not days trying to figure out why my sessions were not working!!

This is using a MySQL DB on Digital Ocean. Why is this broken? Is it Digital Ocean's problem? Did I configure something wrong in my Ubuntu server setup?

@babyoumine
Copy link

its not broken, in mysql 5.7 passwords are stored differently and that's why that happens i think

@LaurentDhont
Copy link

This should work now as the package is changed to mysql2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants