简体   繁体   English

数据库访问被拒绝连接问题

[英]Database Access Denied connection issue

I am trying to make mysql database connection from my war file using jdbc connection string as shown below:- 我正在尝试使用jdbc连接字符串从我的war文件建立mysql数据库连接,如下所示:

    String connectionURL = "jdbc:mysql://localhost:3306/DatabaseName? user=DatabaseUserName;password=DatabasePassword";

Now my war file and database both available on server, & i am doing my execution from server itself. 现在我的war文件和数据库都可以在服务器上使用了,我正在从服务器本身执行我的执行。 But the problem is that i am getting below error which says:- 但是问题是我得到以下错误提示:-

    INFO: java.sql.SQLException: Access denied for user 'grandsho_root;password=pwd'@'localhost' (using password: NO)

where 哪里

grandsho_root is my user, pwd is my password ...I need to know what exactly is this problem? grandsho_root是我的用户,pwd是我的密码...我需要知道这到底是什么问题? Do i need to perform GRANT ALL command. 我是否需要执行GRANT ALL命令。 or something like that? 或类似的东西?

When you get the message "(using password: NO)" this means you were trying to connect without a password set. 当您收到消息“(使用密码:否)”时,这表示您尝试在未设置密码的情况下进行连接。 The log message tells you that the user "grandsho_root;password=pwd" is not allowed to connect. 日志消息告诉您不允许用户“ grandsho_root; password = pwd”连接。 This means your connection string is wrong because you use ; 这意味着您使用的连接字符串是错误的; to separate your parameters instead of a &. 分隔参数而不是&。 This is how your connection string should look: 这是您的连接字符串的外观:

jdbc:mysql://localhost:3306/DatabaseName?user=sqluser&password=sqluserpw

When you still have problems please check if your user is set up correctly. 如果仍有问题,请检查您的用户设置是否正确。 Check that grandsho_root has a password set, that he is allowed to connect from localhost and you granted the necessary privileges to your schema. 检查grandsho_root是否设置了密码,是否允许他从本地主机连接,并且您授予了对模式必要的特权。

Also check the MySQL documentation here 还要在这里查看MySQL文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM