我在用Windows的Navicat连接Ubuntu虚拟机中的MySQL时(Ubuntu使用的是16.04版本),遇到了以下问题:
通过上网查找,找到以下解决方法:
1.登入MySQL
mysql -u root -p
输入密码
use mysql;
2
alter user 'root'@'localhost' identified with mysql_native_password by 'root';
flush privileges;
3
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option; (可能字母要全部大写)
flush privileges;
4.修改IP
sudo vim /etc/mysql/mysql.conf.d/mysql.cnf
将 bind-address = 127.0.0.1 中的IP修改为: 0.0.0.0
5
退出mysql
重启MySQL
service mysql restart
希望对大家有帮助