0.修改mysql配置文件
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
将:
bind-address = 127.0.0.1
改为:
bind-address = 0.0.0.0
重启mysql服务
systemctl restart mysql.service
1.进入mysql修改mysql下user表
use mysql
select Host,User from user;
UPDATE user SET Host = '%' WHERE User = 'root(视情况而定)';
退出数据库 重启mysql:
systemctl restart mysql.service
创建远程用户
//不限ip
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
//指定ip
CREATE USER 'username'@'192.168.1.100' IDENTIFIED BY 'password';
网友评论