MySQL forgot root user password modification method

Source: Internet
Author: User

In general, there are several ways to modify user passwords in MySQL:

1. Modify your password to be available:

Set Password=password (' 123456 ');

2. Modify other user's password to be available:

Set password for ' username ' @ ' host ' =password (' 123456 ');

3. By modifying the password field in the user table in the MySQL library, you can:

Update Mysql.user set Password=password (' 123456 ') where user= ' username ' and host= ' 192.168.1.172 ';

4. Use the mysqladmin command:

mysqladmin-uusername-p1234 password "123456" (where 1234 is the old password and 123456 is the new password)

The above several command methods are in the user login and have the appropriate permissions to modify, such as the root user, if the root user's password has also forgotten how to do, you can modify the following ways:

1. Close the database: service MySQL stop;2. Use Mysqld_safe--skip-grant-tables & start Database3. Use a blank password to enter the database: After the MySQL command, enter directly. 4. Use the UPDATE statement to modify the root password. 5. Close the database and restart the data service in normal mode MySQL stop;service mysql start;

MySQL forgot root user password modification method

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.