MySQL Reset Root Password

Source: Internet
Author: User

The approximate steps are as follows:
1: Stop MySQL server
2: Start MySQL with Mysqld_safe
3: Change root password
4: Exit, restart MySQL server


Step One: There are several ways to stop the MySQL server:
1. Stop MySQL with service mysqld stop
2. If not, use the KILL command directly to stop the MYQLD service, first need to use ps aux | grep mysql to view the MySQL-related process PID, (using PS aux can see the PID is the second column), and then use the kill-9 XXXX in turn kill


Step two: Start MySQL with Mysqld_safe
Use the following command to start MySQL:

Mysqld_safe--skip-grant-tables &
Until you see the following prompt, it indicates a successful start
Starting mysqld daemon with databases From/var/lib/mysql
Log in to MySQL with the root account
Mysql-u Root

Step Three: Modify the MySQL root password

mysql> use MySQL; mysql> Update user Set Password=password ("New-root-password") where user= ' ROOT ';mysql> flush Privileges;mysql > quit;



Step four: restart MySQL


MySQL Reset Root 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.