Web Project hits War package deployed to Tomcat times MySQL Access denied for user ' root ' @ ' localhost ' (using Password:yes) Error solution

Source: Internet
Author: User
Tags mysql client tomcat server

Web project using root account root password to deploy, through eclipse loading to the Tomcat server can be published successfully, into the war package into the Tomcat WebApps directory cannot be published successfully, error:

Jdbc.properties involves MySQL configuration:

The error is obvious, related to the MySQL password, but the jdbc.properties configuration file used by the two-way deployment project is the same. So certainly not the wrong password caused, had to find degrees Niang, O (∩_∩) o haha ~.

Most of the posts on the Internet are logged by running the mysql-u root-p command, so I'll try this method to log in and see if the same problem exists.

The reason for this is that the root account does not open the remote access permission by default, so you need to modify the relevant permissions.

Workaround:

Method One:

1. Open the My.ini file in the MySQL directory, add a line "Skip-grant-tables" at the end of the file, save and close the file. (WIN7 default installation, My.ini in C:\ProgramData\MySQL\MySQL Server 5.6)

2. Restart the MySQL service.
3. Enter the MySQL bin directory via the command line, type "Mysql-u root-p" (without entering the password) and enter the database. (WIN7 default installation, Bin directory: C:\Program files\mysql\mysql Server 5.6\bin)
4. Execute "use MySQL;", using MySQL database.
5. Execute "Update user set Authentication_string=password (" admin ") where user= ' root '; (Change the root password)
6. Open the My.ini file in the MySQL directory, delete the last line of "Skip-grant-tables", save and close the file.

The front step, in fact, can also be directly through the MySQL client tool to modify the root password. ()

7. Restart the MySQL service.
8. Enter "Mysql-u root-padmin" on the command line to successfully connect to the database.
Complete the steps above, modify the Jdbc.properties configuration, and the Eclipse and war package methods can be successfully deployed to the Tomcat server. The problem is finally solved.

Appendix Method Two:

1. Administrator login system, stop the MySQL service or end the MYSQLD-NT process;
2. Go to the command line and come to the MySQL installation directory. Assuming that the installation directory is d:\mysql\, CMD enters the command line;
3. Run D:\Program files\mysql\mysql Server 5.5\bin\mysqld-nt--skip-grant-tables start MySQL, turn off check of permissions;
4. Run D:\Program files\mysql\mysql Server 5.5\bin\mysqladmin-uroot flush-privileges password "newpassword" to reset the root password;
5. Restart the MySQL service;

Small episode:

In solving the problem, according to the online description, through the mysql-u root-p password way to access MySQL, the results reported the following error:

But the strange thing is that this command I'm going to lose. It will require a password again, and then return "ERROR 1049 (42000): Unknown database ' 123456 '"

This error message is obvious, the password that follow our-p is the name of the database. But the-p parameter, p should represent the password. Baidu found that,-p and the password is linked together.

Mysql-h Localhost-u Root-ppassword

-p and password is connected together, hurriedly a try, sure enough to log in!

If you have any questions, please correct me, thank you, hope to help the needs of the small partners, O (∩_∩) o~

Web Project hits War package deployed to Tomcat times MySQL Access denied for user ' root ' @ ' localhost ' (using Password:yes) Error solution

Related Article

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.