mysql配置,问题解决:Host '**.***.**.***' is not allowed to connect to this MySQL server.
2017-06-01 16:06
543 查看
前几天因为某些原因,服务器需要回滚,mysql数据库恢复了之后需要重新配置,如下错误是某个恢复配置的环节出错造成的,研究发现 是授权user的时候 犯错造成的。
java.sql.SQLException: null, message from server: "Host '**.***.**.***'' is not allowed to connect to this MySQL server"
出现这种错误的原因是 你使用远程登录的用户不允许从远程登录(远程等不上),
解决方法:
在远程的服务器上 使用命令行登录mysql.
一:命令行授权:
mysql > grant all privileges on db_name.* to usr_name@'%' identified by 'pwd';
其中,db_name 是数据库名, usr_name 用户名, pwd 密码。'%' 为通配符。
mysql > flush privileges ;
或者
二:更改用户表:mysql > use mysql;
当然也可以在work bench , phpMyAdmin等可视化界面操作。
ps:
远程登录服务器还需打开3306短端口:
# iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
# service iptables save
mysql配置文件接收所有ip链接:
# vi etc/mysql/my.cnf //部分系统路径不同
将绑定ip改为
bind-address = 0.0.0.0
java.sql.SQLException: null, message from server: "Host '**.***.**.***'' is not allowed to connect to this MySQL server"
出现这种错误的原因是 你使用远程登录的用户不允许从远程登录(远程等不上),
解决方法:
在远程的服务器上 使用命令行登录mysql.
一:命令行授权:
mysql > grant all privileges on db_name.* to usr_name@'%' identified by 'pwd';
其中,db_name 是数据库名, usr_name 用户名, pwd 密码。'%' 为通配符。
mysql > flush privileges ;
或者
二:更改用户表:mysql > use mysql;
mysql > update user set host = '%' where user = 'usr_name';;其中, usr_name 用户名,'%' 为通配符。
当然也可以在work bench , phpMyAdmin等可视化界面操作。
ps:
远程登录服务器还需打开3306短端口:
# iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
# service iptables save
mysql配置文件接收所有ip链接:
# vi etc/mysql/my.cnf //部分系统路径不同
将绑定ip改为
bind-address = 0.0.0.0
相关文章推荐
- telnet mysql时出现:is not allowed to connect to this MySQL serverConnection closed by foreign host问题的解决
- E Host '192.168..' is not allowed to connect to this MySQL server 问题解决!
- 解决问题——SQLyog连接报错:Host ''xxx.xx.xxx.xxx'' is not allowed to connect to this MySQL server
- 【解决】Mysql关于Host \'XXX\' is not allowed to connect to this MySQL server 的问题
- mysql远程连接 Host * is not allowed to connect to this MySQL server问题解决方法
- 解决mysql本地可访问,远程无法访问的问题 Host is not allowed to connect to this MySQL server
- 当执行mysqladmin时报'Host' is not allowed to connect to this MySQL server'的解决
- 远程连接MYSQL提示:Host XXX is not allowed to connect to this MySQL server 解决办法
- 连接MySQL数据库报 "Host XXX.XXX.XXX.XXX is not allowed to connect to this MySQL server " 解决办法。
- Discuzx2.5 数据库连接问题 Host '***.***.***.***' is not allowed to connect to this MySQL server
- mysql 远程访问不行解决方法 Host is not allowed to connect to this MySQL server
- mysql不支持远程连接的解决办法(#1130 - Host 'localhost' is not allowed to connect to this MySQL server)
- message from server: "Host is not allowed to connect to this MySQL server"解决办法
- mysql不支持远程连接的解决办法(#1130 - Host 'localhost' is not allowed to connect to this MySQL server)
- Host 'xxx' is not allowed to connect to this MySQL server的解决
- mysql数据库 message from server: "Host is not allowed to connect to this MySQL server"解决办法
- mysql不支持远程连接的解决办法(#报错:1130-host ... is not allowed to connect to this MySql server 开放mysql远程连接 不使用lo
- Host '*.*.*.*' is not allowed to connect to this MySQL server 解决办法
- mysql 远程访问不行解决方法 Host is not allowed to connect to this MySQL server
- mysql连接linux系统提示“登录出现1130 is not allowed to connect to this MySql server”问题,解决方法