![](/img/trans.png)
[英]java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect to this MySQL server"
[英]null, message from server: “Host 'myserver' is not allowed to connect to this MySQL server”
我正在用Java开发一个独立应用程序,在这里我正在使用MYSQL作为数据库。 我的代码在我的系统上运行正常。 我正在使用Ubuntu操作系统。
当我尝试在不同的系统上运行相同的代码时,它给了我上面的错误。
您需要在Mysql中授予权限
use the_database_name; GRANT ALL PRIVILEGES ON the_database_name.* TO 'the_user_name'@'%' IDENTIFIED BY 'password_of_the_user'; FLUSH PRIVILEGES;
我猜您的myserver不在第二个系统的网络中。
你会想GRANT访问权限到不同的服务器。 设置用户ID和密码及其机器IP地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.