vue+express+mysql连接数据库时提示:ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication prot...

最近在学习vue+express+mysql搭建环境,服务器端启动时,提示:

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

经过上网查找信息,发现是mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password 把mysql用户登录密码加密规则还原成mysql_native_password,简单点就是现在是严格加密模式,以前是普通模式,修改加密规则为普通模式

具体方法步骤如下:

1.打开命令行,输入:mysql -u root -p,输入密码,进入mysql数据库(也可以通过navicat直接进入)

2.ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; (修改加密规则 (必写))

3.ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; (更新用户密码 )

4.FLUSH PRIVILEGES; #刷新权限(不输入也可以)

再次尝试服务器端启动,提示监听成功。


修改方法参照源地址:https://www.jianshu.com/p/c8eb6d2471f8

你可能感兴趣的:(vue+express+mysql连接数据库时提示:ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication prot...)