1.改表。
你的帐号不允许从远程登陆,只能在localhost。更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
update user set host = '%' where user = 'root';
2. 授权。
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.3' IDENTIFIED BY 'password' WITH GRANT OPTION; //修改
FLUSH PRIVILEGES; //修改生效
允许用户root从ip为192.168.1.6的主机连接到mysql服务器,并使用password作为密码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
允许用户root从任何主机连接到mysql服务器,并使用password作为密码