Forgot MySQL password reset method under Ubuntu

Source: Internet
Author: User

Http://www.cnblogs.com/yuxc/archive/2012/07/25/2607587.html

1. End the currently running MySQL process.
#/etc/init.d/mysql Stop

2. Run in MySQL Safe mode and skip permission verification.
#/usr/bin/mysqld_safe--skip-grant-tables

3. Re-open a terminal to log in to MySQL as root.
# mysql-u Root

4, modify the root user password.
mysql> use MySQL;
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a

Database changed
mysql> Update user Set Password = Password (' root ') where user = ' root ';
Query OK, 3 Rows Affected (0.00 sec)
Rows Matched:3 Changed:3 warnings:0

Mysql> exit

5. End MySQL Safe mode and run MySQL in normal mode.
#/etc/init.d/mysql Restart

6. Try your newly modified password

Mysql> show grants for ' root ' @ ' 127.0.0.1 ';

mysql> flush Privileges;
Mysql> quit

1Mysql>Use MySQL2Reading table Information forCompletion of Table andcolumn Names3Can turn off this feature to get a quicker startup with-A4 5 Database changed6mysql> Update user Set Password = Password ('Root') Where User ='Root'7- ;8Query OK, 4 rows affected (0.06sec)9Rows Matched:4 Changed:4warnings:0Ten  One  A  -Ysql> Select User,password fromuser; -+------------------+-------------------------------------------+ the| user | password | -+------------------+-------------------------------------------+ -| Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b | -| Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b | +| Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b | -| Root | *81f5e21e35407d884a6cd4a731aebfb6af209e1b | +| Debian-sys-maint | *422d1af27e5e185185fe7e0c56187ab7396542d0 | A+------------------+-------------------------------------------+ at5 rowsinchSet (0.00sec) -  -Mysql>

Forgot MySQL password reset method under Ubuntu

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.