Mysql报错java.sql.SQLException:null,message from server:"Host 'xxx.xx.xx.xx' is not allowed to connect

Mysql连接报错:java.sql.SQLException:null,message from server:"Host ‘27,45,38,132’ is not allowed to connect.

原因是:远程服务器不允许你的java程序访问它的数据库。所以,我们要对远程服务器进行设置,使它允许你进行连接。

步骤:一、打开mysql控制台,输入:use mysql;

二、输入:show tables;

三、输入:select host from user;

四、输入:update user set host =’%’ where user =‘root’;

五、打开计算机的服务界面,重新启动mysql服务,远程服务器就允许程序连接数据库了。

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
java.sql.SQLException: null, message from server: "Host '59.41.160.220' is not allowed to connect to this MySQL server"是一个错误消息,表示指定的主机(59.41.160.220)没有权限连接到MySQL服务器。这通常是由于MySQL服务器的访问控制列表(ACL)配置导致的。 要解决这个问题,可以采取以下步骤: 1. 登录到MySQL服务器。 2. 运行以下命令以授予指定主机的访问权限: GRANT ALL PRIVILEGES ON *.* TO 'username'@'59.41.160.220' IDENTIFIED BY 'password'; 其中,'username'是您希望使用的用户名,'59.41.160.220'是您希望授予访问权限的主机IP地址,'password'是您希望使用的密码。 3. 刷新MySQL权限以使更改生效: FLUSH PRIVILEGES; 4. 退出MySQL服务器。 通过执行上述步骤,您应该能够解决java.sql.SQLException: null, message from server: "Host '59.41.160.220' is not allowed to connect to this MySQL server"错误,并允许指定主机连接到MySQL服务器。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [bug-linux-win(java.sql.SQLException: null, message from server: “Host ‘192.168.1.66‘ is not ...](https://blog.csdn.net/computer408/article/details/123920935)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [java.sql.SQLException: null, message from server: “Host ‘%’ is not allowed to connect to](https://download.csdn.net/download/weixin_38720653/13687787)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值