我在用自己的windows上的navicat远程连接ubuntu服务器的mysql,提示2003错误,无法连接,搜索博客,经过以下步骤解决。
注:本人mysql为5.7
firewall-cmd --state
mysql -uroot -p use mysql; select host,user,authentication_string from mysql.user;
如果没有host为%的用户,代表不允许远程连接。
那么输入以下命令
grant all privileges on *.* to 'root'@'%' identified by 'xxxxxx'; flush privileges;
其中xxxxxx是你的mysql密码。一定要flush一下
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
将bind-address = 127.0.0.1改为0.0.0.0
sudo service mysql restart