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

在测试node连接mysql数据库时,好家伙,密码,用于名都是正确的,结果爆出如下错误:Client does not support authentication protocol requested by server;consider upgrading MySQL,怎么修改都不对,人都弄傻了,最后查阅资料了解到,是加密方式不同导致的。解决方式如下

  1. win+r键,输入cmd进入命令行窗口,在cd 进入安装mysql目录下的bin 目录,或者直接通过文件夹进入bin目录,在进入命令行窗口

  2. 登录mysql,输入mysql -u root -p 点击确定 之后会提醒你输入密码

  3. 输入 use mysql

  4. 输入alter user ‘root’@‘localhost’ identified with mysql_native_password by ‘你的密码’;注意最后的分号也需要

  5. 输入flush privileges; //刷新

  6. 之后就可以连接啦

更多推荐

Client does not support authentication protocol requested by server;consider upg