mysql error:Host is not allowed to connect to this MySql server
访问虚拟机中Mysql时出现如下错误:
原因:该mysql用户不允许远程登录
解决:授权
1> 允许用户从任何主机连接到mysql server
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES;
2> 允许用户从指定IP访问mysql server
其中,host为特定IP地址
GRANT ALL PRIVILEGES ON *.* TO 'username'@'host' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES;
3> 允许用户从特定IP访问mysql server指定数据库
其中,host为特定IP地址
GRANT ALL PRIVILEGES ON dbname.* TO 'username'@'host' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES;