报错 "Host '192.168.209.1' is not allowed to connect to this MySQL server"
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_37632381/article/details/84933091
严重: create connection error java.sql.SQLException: null, message from server: "Host '192.168.209.1' is not allowed to connect to this MySQL server" at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1040) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2191) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2222) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2017) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:779)**加粗样式**
前提:在window下的eclipse连接Linux虚拟机中的MySQL报错,但是用window下的
navicat可以正常连接同一数据库。
分析报错提示:Host 用户不允许连接数据库。
从上面的截图可以看出chyun用户只允localhost连接。
解决方案:
改表法。
在localhost的那台电脑,登入mysql后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从"localhost"改称"%"
mysql -u root -pvmwaremysql>use mysql;
mysql>update user set host = ‘%’ where user = ‘chyun’;
mysql>flush privileges;
mysql>select host, user from user;
授权法。
例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。
GRANT ALL PRIVILEGES ON . TO ‘myuser’@’%’ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码
GRANT ALL PRIVILEGES ON . TO ‘myuser’@‘192.168.1.3’ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器的dk数据库,并使用mypassword作为密码
GRANT ALL PRIVILEGES ON dk.* TO ‘myuser’@‘192.168.1.3’ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
————————————————
版权声明:本文为CSDN博主「爱吃鱼的小乖乖」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_37632381/article/details/84933091
报错 "Host '192.168.209.1' is not allowed to connect to this MySQL server"的更多相关文章
- Mysql远程连接报错:SQL Error (1130): Host '192.168.61.128' is not allowed to connect to this MySQL server
Mysql远程连接报错:SQL Error (1130): Host '192.168.0.18' is not allowed to connect to this MySQL server ...
- Mysql远程连接报错:SQL Error (1130): Host '192.168.6.128' is not allowed to connect to this MySQL server
通过SQLyog连接linux中的MySQL报错问题:SQL Error (1130): Host '192.168.6.128' is not allowed to connect to this ...
- SQL Error (1130): Host '192.168.1.126' is not allowed to connect to this MySQL server
通过HeidiSQL连接MYSQL数据库报错: SQL Error (1130): Host '192.168.1.126' is not allowed to connect to this MyS ...
- 通过navicat连接mysql服务器提示SQL Error (1130): Host '192.168.1.100' is not allowed to connect to this MySQL server
新装一个mysql,尝试用通过navicat连接mysql服务器的时候提示: SQL Error (1130): Host '192.168.1.100' is not allowed to conn ...
- ERROR 1130 (HY000): Host '192.168.20.165' is not allowed to connect to this MySQL server
问题 远程连接mysql时遇到如下问题: ERROR 1130 (HY000): Host '192.168.20.165' is not allowed to connect to this MyS ...
- MySQL ERROR 1130 (HY000): Host '192.168.1.8' is not allowed to connect to this MySQL server
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.8' IDENTIFIED BY 'www.linuxidc.com' WITH GRANT OPTI ...
- hive报错java.sql.SQLException: null, message from server: "Host '192.168.126.100' is not allowed to connect to this MySQL server"
- java.sql.SQLException: null, message from server: "Host '192.168.xxx.xxx' is not allowed to connect to this MySQL server"
当你连接自己的电脑上的MySQL时,报这样的错,你可以把ip换成 127.0.0.1或者localhost ,当然前提是用户名和密码正确
- linux中mysql运程连接时错误host ‘192.168.0.1’ is not allowed to connect to this MySql server
1.改表法 可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "u ...
随机推荐
- springmvc模式下的上传和下载
接触了springmvc模式后,对上一次的上传与下载进行优化, 上次请看这里. 此处上传的功能依旧是采用表格上传.文件格式依旧是 <form action="${pageContext ...
- MySQL的MHA实现高可用性
MySQL高可用 (1)MMM: Multi-Master Replication Manager for MySQL,Mysql主主复制管理器是一套灵活的脚本程序,基于perl实现,用来对mysql ...
- RAM disk
Linux 系统创建RAM disk 参考: https://blog.csdn.net/linuxdashencom/article/details/52319671 https://www.lin ...
- ping加上时间信息
一.linux系统ping加时间戳信息 1.ping 加时间信息,然后还要实时保存到一个文件中,那么就与awk结合 ping 115.239.211.112 -c 10 | awk '{ print ...
- 更改jupyter notebook的单元格宽度和主题颜色(theme)
一.单元格宽度 这个命令: jt -t gruvboxl -f roboto -fs 12 -cellw 100% -T -N 它将宽度设置为100% 二.主题颜色 在用jupyter noteboo ...
- python_字符串方法
1.字符串大小写转 value = "wangdianchao" # 转换为大写 big_value = value.upper() print(big_value) # 转换为小 ...
- 记一次k8s服务504 timeout
线上服务做集群扩容,调整了节点机器配置,在升级完毕之后,发现某些时候请求较慢,或者直接504 timeout 超时,必现情况,点击几次都是,且并没有代表性. 1.检查istio 日志是否有504 的日 ...
- shiro框架的UsernamePasswordToken与对应Realm中的AuthenticationToken的一点比较(转)
这里以简单的登陆为例子 控制器对应的登陆方法: @RequestMapping(value = "/login", method = RequestMethod.GET) publ ...
- 005_linuxC++之_指针的引入
(一)直接看代码 #include <iostream> using namespace std; int add(int a){ a = a + ; return a; } int ad ...
- 004_linuxC++之_函数的重载
(一)源码下载 (一) 函数的重载:同一个命名函数,通过传入参数的不同,调用不一样的函数 上面程序的运行结果: (二)函数只能通过参数的不一样重载函数,不能通过返回参数的不一样重载函数 运行结果报错 ...