MySQL无法远程访问

首先确认服务器有没有开放端口

开启远程登录

mysql -uroot -p

use mysql;

update user set host = "%" where user ='root';

grant all privileges on *.* to 'root'@'%' with grant option;

flush privileges;

假如还不行(反正我是不行),检查是否只允许本地登录

## 位置仅供参考
vim /etc/mysql/mysql.conf.d/mysqld.cnf
# #bind-address = 127.0.0.1 or #skip-networking
# 重启mysql

posted @ 2022-05-01 22:59  kylinmac  阅读(104)  评论(0)    收藏  举报