mysql远程访问配置--navicat提示2003 - Can't connect to MySQL server on 'x.x.x.x'
mysql基础安装参考https://blog.csdn.net/weixx3/article/details/80782479
mysql安装成功之后navicat连接不上,提示“2003 - Can't connect to MySQL server on 'x.x.x.x' ”
查了下文档,配置两部分就行了:更改mysql配置文件的监听地址、授权用户访问
- 更改配置文件的监听地址
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
把127.0.0.1改为0.0.0.0就行了
然后重启服务
sudo service mysql restart
-
root用户可以从任何主机访问任何内容的授权语句
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'a' WITH GRANT OPTION;
刷新一下权限就生效了
mysql>FLUSH PRIVILEGES
-
查看mysql服务正常否
systemctl status mysql
这样就连接成功了