mysql如何开启对外连接?

mysql如何开启对外连接?


1.修改Mysql配置文件 /etc/mysql/my.cnf

注释掉 bind-address = 127.0.0.1
vi /etc/hosts.allow
添加:Mysqld: ALL

2.重启Mysql sudo /etc/init.d/mysql restart

3.root登录用户赋予权限
mysql -uroot -ppassword
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yxserver' WITH GRANT OPTION;
FLUSH PRIVILEGES;

GRANT Create view,Show view, index, create temporary tables ON *.* TO 'waf'@'127.0.0.1' IDENTIFIED BY 'yxserver';

原文地址:https://www.cnblogs.com/sunscheung/p/4343556.html