MySQL安装后本地Navicat连接报错如下:
解决方法:
进入cmd
1、进入mysql的bin目录,输入:cd C:\Program Files\MySQL\MySQL Server 8.0\bin
2、登录mysql,输入:mysql -u root -p
3、输入密码,进入
4、更新一下用户的密码,执行下面的语句:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
5、刷新权限
FLUSH PRIVILEGES;
如果连接还报错,执行如下:
1、进入mysql的bin目录,输入:cd C:\Program Files\MySQL\MySQL Server 8.0\bin
2、登录mysql,输入:mysql -u root -p
3、输入密码,进入
4、use mysql;
5、select host from user where user='root';
6、update user set host = '%' where user ='root';
7、flush privilegs;
8、ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';