navicat远程连接mysql,2003 can't connect to mysql server on 10038
参照URL:https://blog.csdn.net/makeworks/article/details/77844386
①:netstat -an | grep 3306
来查看mysql默认的端口3306是否开启,允许哪个ip使用,如果你发现,前面有127.0.0.1,就说明,3306端口只能本机ip使用
所以,我们需要
②:打开mysql配置文件 sudo vi /etc/mysql/mysql.conf.d/server.cnf 或者my.ini
将bind-address = 127.0.0.1注销
或改为bind-address = 0.0.0.0
③:进入mysql,mysql -u root -p
输入密码
对远程用户进行授权,
grant all privileges on *.* to 'root'@'%' identified by 'xxxxxx';
这里的root 是你远程登录的用户,xxxxxx是你登录使用的密码,然后可以在mysql数据 表中查看到你这个用户已经被添加到user表中。
MariaDB [mysql]> grant all privileges on *.* to root@"%" identified by '123qwe!@#' with grant option;
④:修改生效,mysql>FLUSH PRIVILEGES;
⑤:退出,mysql>EXIT
⑥:重启MySQL服务,service mysqld restart
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123qwe!@#' WITH GRANT OPTION;
FLUSH PRIVILEGES;
上記の方法が試した、出来なければ、下記の命令を行って試します
systemctl stop firewalld
firewall-cmd --zone=public --add-port=3306/tcp --permanent
systemctl start firewalld
https://blog.csdn.net/aiming66/article/details/78880094?foxhandler=RssReadRenderProcessHandler
转载于:https://www.cnblogs.com/killclock048/p/9790346.html