报错:
Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server
1、方法:
mysql -u root -pvmwaremysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
2、使用授权的方法:
2.1、实例
登录MySQL
mysql>grant all privileges on db_name.db_table to 'user_name'@'remote_address' identified by 'password' with grant option;
名词解释:
db_name:MySQL服务器上的数据库名
db_table:MySQL服务器上的数据表名
user_name:远程主机的登录用户名
remote_address:远程主机IP地址
password:远程主机的登录密码
2.2、# 创建数据库并授权
CREATE DATABASE `ityym` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON o2oa.* TO 'ityym'@'%' identified by 'ADSHgyu@12' with grant option;
flush privileges;
########################################
2.3、你想root使用mypassword从任何主机连接到mysql服务器的话。
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
2.4、你想root使用mypassword从任何主机连接到mysql服务器的话。
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
2.5、//赋予任何主机访问数据的权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION ;
FLUSH PRIVILEGES;
2.6、授权新的数据库的创建:
GRANT ALL PRIVILEGES ON ios_mobile.* TO 'root'@'10.92.XX.XX' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;