Sequelize does not suport the MySQL 8 autentication protocol and I'm not getting how to change this protocol

家住魔仙堡 提交于 2019-12-10 10:45:48

问题


I'm trying to migrate a db with Sequelize working with MySQL 8.0.15, but I'm not able to do that. I keep receiving this error message.

Sequelize CLI [Node: 10.15.0, CLI: 5.4.0, ORM: 5.3.5]

Loaded configuration file "config/config.json".
Using environment "development".

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

I've tried every single solution for this problem. The thing is when i try to change the MySQL root password the message i get is this one:

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

Then I did try to change the password validate policy following this procedure

https://dev.mysql.com/doc/refman/5.6/en/validate-password-installation.html

then MySQL crashed cause it's deprecated. Then I tried this one

https://dev.mysql.com/doc/refman/8.0/en/validate-password-installation.html

Then I got this

mysql> INSTALL COMPONENT 'file://component_validate_password';
ERROR 3529 (HY000): Cannot load component from specified URN: 
'file://component_validate_password'.

Then I checked where the component is

ls /usr/lib64/mysql/plugin/component_v*
/usr/lib64/mysql/plugin/component_validate_password.so

Anyone can help? I'm realy out of options, now!

Thanks in advance


回答1:


If you want to use MySQL 5.x style authentication, typically all you have to do is add this to your my.cnf:

[mysqld]
default_authentication_plugin=mysql_native_password

Do this before adding any users. Only use users for connecting via Sequelize, never root.




回答2:


If you are using MySQL 8.0 then https://dev.mysql.com/doc/refman/5.6/en/validate-password-installation.html then this shouldn't work.

Have used mysql_secure_installation and installed the validate_password_component then?

If yes, in that case, the plugin must already be installed and all you need to do is set validate_password related parameters in the options file (default /etc/my.cnf) and some options require a server restart.




回答3:


For those who cannot edit system variables (for instance, if you're using a managed database in AWS or DigitalOcean), this works as well:

ALTER USER 'foo'@'bar' IDENTIFIED WITH mysql_native_password BY 'password';
flush privileges;

Or, if you cannot run flush privileges; like me:

DROP USER 'foo'@'bar';
CREATE USER 'foo'@'bar' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT INSERT, SELECT, ... ON mydb.* TO 'foo'@'bar';


来源:https://stackoverflow.com/questions/55670688/sequelize-does-not-suport-the-mysql-8-autentication-protocol-and-im-not-getting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!