MySQL forgot password

Source: Internet
Author: User
Tags mysql login

1. Modify the MySQL login settings:

Add a sentence to the paragraph in [mysqld]: Skip-grant-tables
For example:

[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock Skip

Save and exit

2, restart Mysqld

# service Mysqld Restart stopping MySQL: [OK] starting MySQL: [OK]

3. Log in and modify the root password of MySQL

# mysql Welcome toThe MySQL Monitor. CommandsEnd  with;or\g. Your MySQL Connection ID is 3  toServer version:3.23. AboutType'Help ;' or '\h'  forHelp. Type'\c'  toclear the buffer. mysql>  UseMySQL;Databasechanged MySQL> UPDATE User SETPassword=Password ('New-password')WHERE User = 'Root' ; Query OK,0Rows Affected (0.00sec) Rows matched:2Changed:0Warnings:0MySQL>FlushPrivileges ; Query OK,0Rows Affected (0.01sec) MySQL>Quit

4. Change the MySQL login settings back

Delete the skip-grant-tables you just added in the paragraph [mysqld]
Save and exit

5, restart Mysqld

# service Mysqld Restart stopping MySQL: [OK] starting MySQL: [OK]

MySQL forgot 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.