java - 为什么我用命令行连接mysql时可以连上,但是用程序连接就连不上了呢?
阿神
阿神 2017-04-18 10:03:29
0
5
953

用命令行可以连接上数据库,在idea连接的时候报这个错误,数据库账号和密码也对了呀 ,不知道为什么会出现这个错误,求大神指点下.

阿神
阿神

闭关修行中......

reply all(5)
Peter_Zhu

Check the username, the error prompted is minjj@localhost cannot be accessed

That is, the username used when connecting is minjj instead of the root account you posted.
Check your code,

  1. Did the user name be written in the connection code?

  2. Whether the configuration file is read correctly

巴扎黑

The account you logged in with is different from the account in your profile. Find out the reason yourself

大家讲道理

80% of the time remote access is not enabled and IP addresses similar to 127.0.0.1 are not allowed to access, or it is hard-coded in the program code

Peter_Zhu

Maybe it’s the username configured directly in the db. When spring reads it through ${username}, it seems to read the name of the computer administrator? I’m not sure exactly. Changing the username to something else solves the problem. Thank you everyone

PHPzhong

Re-authorize the mysql database root account. The command line should be set to only allow localhost request address login. It can be modified to the % method

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template