Linux forgot MySQL password

Source: Internet
Author: User

One of the ways to recover MySQL root password

If you forget the MySQL root password, you can reset it in the following ways:

1.KILL off the MySQL process in the system;

Killall-term MySQLd

2. Start MySQL with the following command to start without checking permissions;

Safe_mysqld--skip-grant-tables &

3. Then log in to MySQL using the root user with a blank password;

Mysql-u Root

4. Change the password of the root user;

mysql> Update Mysql.user Set Password=password (' New password ') where user= ' root ';

mysql> flush Privileges;

Mysql> quit

1. Stop mysqld;

Sudo/etc/init.d/mysql stop

(You may have other ways to stop mysqld running anyway)

2. Start MySQL with the following command to start without checking permissions;

MySQLd--skip-grant-tables &

3. Then log in to MySQL using the root user with a blank password;

Mysql-u Root

4. Change the password of the root user;

mysql> Update Mysql.user Set Password=password (' NewPassword ') where user= ' root ';

mysql> flush Privileges;

Mysql> quit

Restart MySQL

/etc/init.d/mysql restart

You can login with the new password NewPassword

Linux forgot MySQL password

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.