chill117 / express-mysql-session

A MySQL session store for the express framework in node
MIT License
313 stars 106 forks source link

ER_NOT_SUPPORTED_AUTH_MODE #109

Open tony0511 opened 4 years ago

tony0511 commented 4 years ago

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

chill117 commented 4 years ago

Can you provide more information?

MichaelKohler commented 3 years ago

Running into this as well:

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 commented 3 years ago

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 commented 3 years ago

oh and if this doesnt work remove the @

JoshMayberry commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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

LaurentDhont commented 1 year ago

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