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

1. 登录mysql

mysql -u root -p

2.查看mysql数据库:

use mysql;

 3. 输入:

 select user,host from user;

MySQL 5.7数据库可以用任意IP连接访问_第1张图片

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

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

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

MySQL 5.7数据库可以用任意IP连接访问_第2张图片

 6.重启数据库:
service mysqld restart

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

你可能感兴趣的:(MySql)