简体   繁体   中英

Database Access Denied connection issue

I am trying to make mysql database connection from my war file using jdbc connection string as shown below:-

    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. 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? Do i need to perform GRANT ALL command. 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. 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.

Also check the MySQL documentation here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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