修改mysql 库
use mysql; //使用msql库
update user set host = ‘%’ where user = ‘root’; 修改root用户可以访问所以ip,%可以修改为特定的IP
select host, user from user; 查看用户与主机对应
flush privileges; //刷新生效
修改密码
update user set password=password(‘123’) where user=’root’ and host=’localhost’;指定某个主机上的某个用户访问密码
如果修改提示Unknown column ‘password’ in ‘field list’
则将SQL改为:
update user set authentication_string=password(‘123456789’) where user=‘root’ and host=‘%’;
即:password改为authentication_string
执行修改操作后,必须执行flush privileges; 方可生效
指定其他主机远程访问
GRANT ALL PRIVILEGES ON . TO root@“%” IDENTIFIED BY ‘123456789’