MySQL 5.7数据库可以用任意IP连接访问

1. 登录mysql:
mysql -u root -p

2.查看mysql数据库:
use mysql;
 

3. 输入:
select user,host from user;

135116_V0um_2376274.png

 

4. 更新如下即可(百分号不能发布):

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

140132_JLN3_2376274.png

FLUSH PRIVILEGES;

 

5.查看:
select user,host from user;

135938_ZdOG_2376274.png

6.重启数据库:
service mysqld restart

转载于:https://my.oschina.net/michaelshu/blog/1786788