MySQL modifies the root user password

Source: Internet
Author: User

First, I want to say one sentence:

I despise people who are engaged in it in China. They are completely speechless and solve this problem almost exactly the same. They are copied. What's more, an error is thrown: Access denied for user 'root' @ 'localhost'
The database 'mysql' has also copied other people's solutions. It is not ashamed to say that the problem has been solved. I don't think I have actually performed any operations.

The following is my solution based on others' reference:

Question:

After I installed MySQL on centos and used the navicat link, a MySQL-SQL error (1130): Host IP is not allowed to connect to this MySQL server error is thrown, for more information, see http://361324767.blog.163.com/blog/static/114902525201232832621498 /.

After the problem is solved, I log on to MySQL and enter mysql-u root without an error. However, when the following statement is executed:

Mysql> use MySQL

Throw this error. For more information, see the following:

Certificate ----------------------------------------------------------------------------------------------------------------------------------------------

If you enter MySQL first, and then enter use MySQL, the following error occurs: Access denied for user ''@ 'localhost' to database 'mysql'
Also, you can enter mysql. An error occurs when you enter mysql-u root:
Access denied for user 'root' @ 'localhost' (using password: no ).
The reason is:
An error occurred while updating the root password yesterday.
Update user SET Password = '000000' where user = "root" // This is an error. The password is not 123456.
Set Password = PASSWORD ('000000') where user = "root"
Procedure:
Close MYSQL:
# Service mysqld stop
Then:
# Mysqld_safe -- skip-grant-tables
Start MYSQL:
# Service mysqld start
Mysql-u Root
Mysql> use MySQL
Mysql> Update user SET Password = PASSWORD ('xxx') where user = 'root ';
Mysql> flush privileges;
Mysql> \ q

Certificate ---------------------------------------------------------------------------------------------------------------------------------------------------------

Step by step according to the big copy steps, without any effect. carefully study the user ''@ 'localhost' in the error message, which indicates that the user ='' information in the User table is incorrect, then execute update
User SET Password = PASSWORD ('') where user = '';

Decisive has no effect.

Anonymous logon is not allowed. Run the following statement:

Mysql> Delete from user where user = '';

Mysql> flush privileges;

Mysql> \ q

# Service mysqld restart

Solve the problem.

------------------------------

I would like to advise all IT colleagues. Are you professional? What do you mean by every question? Isn't it interesting to copy it? The faces of all Chinese IT people, and the IT industry in China are all ruined by your group.

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.