2

I'm trying to connect SailsJS with MySQL

default: {
  adapter: require('sails-mysql'),
  url: 'mysql://root:root@localhost/ventas'
},

But whenever I do a 'sails lift' I get the following error:

error: A hook (`orm`) failed to load!
error:
error: { error:
   { Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    at Handshake.Sequence._packetToError (C:\ticket\node_modules\mysql\lib\protocol\sequences\Sequence.js:48:14) }

I'm just using the web app template that comes with sails with no added code.

Any ideas?

Dharman
  • 26,923
  • 21
  • 73
  • 125
Toshio Minei
  • 68
  • 1
  • 7

3 Answers3

1

The problem may be with encrypting the password. MySQL 8.0 uses caching_sha2_password. You need change it to mysql_native_password:

ALTER USER 'user' identified with mysql_native_password BY 'password';
Aliaksei
  • 701
  • 6
  • 13
0

The problem is coming from mysql, you need to change the plugin to mysql_native_password and then flush privileges;, see here and here.

Hamza Fatmi
  • 1,187
  • 7
  • 10
-2

Set your password to one with Upper case , lower case, numeric and a special character in it with 8 letters long .