navicat遠程鏈接mysql,2003 can't connect to mysql server on 10038

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 mysql

相關文章
相關標籤/搜索