java.sql.SQLException:用户的访问被拒绝 [英] java.sql.SQLException: Access denied for user
问题描述
我想创建一个可以从任何主机访问Mysql服务器的用户
I want to create an user that can access from any hosts to Mysql server
我使用
create user abc@10.10.131.17 identified by 'abc123'
和
grant all privileges mydb.* to 'abc'@'%';
但是当我运行客户端时,会发生错误:
"java.sql.SQLException: Access denied for user 'abc'@'10.10.0.7' (using password: YES)
But when i run client,the error occurs:
"java.sql.SQLException: Access denied for user 'abc'@'10.10.0.7' (using password: YES)
请帮助我!
推荐答案
您已经创建了一个允许使用IP 10.10.131.17
的用户,并且正在尝试通过IP 10.10.10.7
连接MySQL Server.因此,它将无法正常工作.
要访问MySQL服务器,您必须创建允许IP 10.10.10.7
或允许所有IP使用%
的用户.
You have created an user with allowing IP 10.10.131.17
and you are trying to connect MySQL Server from IP 10.10.10.7
. So it won't work.
To access MySQL Server you have to create user allowing IP 10.10.10.7
or allowing all IPs using %
.
CREATE USER `abc`@`10.10.10.7` IDENTIFIED BY 'abc123'
GRANT ALL PRIVILEGES mydb.* TO `abc`@`10.10.10.7`;
OR
CREATE USER `abc`@`%` IDENTIFIED BY 'abc123'
GRANT ALL PRIVILEGES mydb.* TO `abc`@`%`;
这篇关于java.sql.SQLException:用户的访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!