tslilpress
tslilpress

Reputation: 31

Getting 'Client does not support authentication protocol requested by server; consider upgrading MySQL client' and alter user doesn't fix this

I'm using knex and have mysql 8 installed. Trying to make a simple connection but getting 'Client does not support authentication protocol requested by server; consider upgrading MySQL client'

const knex = require('knex');

const db = knex({
  client: 'mysql',
  connection: {
    host: '127.0.0.1',
    user: 'root',
    password: '12345678',
    database: 'myDatabase'
  },
});

I changed the user to use mysql_native_password by running the query

 alter user 'root'@'localhost' identified with mysql_native_password by '12345678';

but still getting the same error when trying to connect.

Everything I found online was telling me that this query will fix the problem, I'm wondering if I might be missing something or if there might be another reason I'm getting this error.

Any help or advice would be much appreciated!

Upvotes: 1

Views: 1918

Answers (1)

Grace
Grace

Reputation: 303

Replace localhost with %, it worked for me.

Upvotes: 1

Related Questions