Ubuntu设置MySql局域网可以访问

1、打开并修改文件

sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf

把里面的bind-address = 127.0.0.1

改成  # bind-address = 127.0.0.1 进行屏蔽

 

mysql -uroot -p你的密码
use mysql
update user set host = '%' where user ='root';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;
exit;

 

重启服务

sudo /etc/init.d/mysql restart

 

posted @ 2020-02-03 15:32  沉迷编程的程序员  阅读(326)  评论(0编辑  收藏  举报