Access denied for user ' root ' @ ' localhost ' (using password:yes) solution

Source: Internet
Author: User

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

    1. Jdbc.username=Root
    2. 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 ...

    1. CREATE USER ' root ' @ ' localhost ' identified by ' your password ';
    2. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.