Believe this problem most people have met, at least I met three times, and each reason is not the same, the previous period of time the classmate also encountered this problem, asked me how to solve, I put my ideas to solve all said again, found not yet, finally incredibly is another reason ... Hey, say more are tears, summed up as follows:
(Note: This article is based on the normal use of the database, but the program can not connect to the database on the basis of the Doc window or other MySQL GUI is not connected, please self-repair MySQL basic knowledge of it)
Probably means that if you can use the MySQL command line into MySQL, it means that MySQL installation is not a problem, your program is a problem, there is no connection permissions (in detail here). Here to illustrate the point is, very important, is the last word, do not have a space! I just ate this loss ah, in the Jabc.properties configuration username and password, because of the reason for the line, there are spaces inside, plainly or the user name and password error. As follows
- Jdbc.username=Root
- jdbc.password=123456
Root and 123456 There are spaces behind, this is really invisible to the naked eye ah .... So just erase the blanks.
2. User does not have permission (cheat oneself?) Reference
In fact, this is also online to see people say so, they have not used. But I think, if like I mentioned in the 1th, you can use this username and password in the command line mode to enter MySQL, that must have permission to Ah, why also give permission? So for reference only ...
- CREATE USER ' root ' @ ' localhost ' identified by ' your password ';
- GRANT all privileges on * * to [email protected] ' localhost ';
3.mysql and drive jar version conflicts
This is the problem that my classmate appeared, he had no problem in front of us, and then we found that He installed the MySQL is 5.7, but with the driver Jar (mysql-connector) is 5.1.3 (I sent him, blame me), as if the program has been not connected to MySQL, and then no, then uninstalled 5.7 MySQL, reinstall 5.0 of MySQL ... (installed or restarted before it works), so this is a special case ...
Access denied for user ' root ' @ ' localhost ' (using password:yes) solution