#第一步:登录进入数据库
mysql -P 3306 -h 127.0.0.1(你自己的数据库IP地址) -u root -p root
# 第二步:切换身份
use mysql
# 第三步:查看当前的IP段信息
select user,host from user
(此处会罗列user和host信息)
# 如果想要所有Ip字段都可以访问数据库,则用下列语句将host = localhost的部分替换成host = %
update user set host='%' where host='localhost';
# 第四步,授权给相应的IP
grant all privileges on *.* to root@'192.168.1.1' identified by 'password'
#第五步,刷新
flush privileges;
#执行第三步,查看信息