mysql配置外网访问权限

mysql配置外网访问权限

修改配置文件

1
2
[mysqld]
bind-address=0.0.0.0

登录mysql并修改数据库权限

1
2
3
4
5
6
7
8
9
mysql -u root -p
mysql> use mysql;
mysql> select user,host from user;

mysql> update user set host='%' where user='root';
mysql> flush privileges;

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql> flush privileges;