MySQL forgot password under Linux

Source: Internet
Author: User
Tags mysql command line

System: CentOS6.6 64-bit

Refer to the document (see the original URL): MySQL forgot root password under Linux How to do _ Baidu experience http://jingyan.baidu.com/article/1709ad80a8caf14634c4f013.html specific steps are as follows:
  1. Modify the MySQL configuration file (default is/ETC/MY.CNF) and add a line under [Mysqld] Skip-grant-tables

  2. after saving the configuration file, restart the MySQL services service mysqld restart
  3. again into the MySQL command line mysql-uroot-p, enter the password when the direct return, will enter the MySQL database, this time according to the general process of modifying the root password.    input: >use MySQL;  Change database >update user SET Passord =password ("passwd") WHERE user= ' root ';  Reset password >flush privileges; Refresh the MySQL system permissions related tables to prevent access after the change, or restart the MySQL server
  4. after the password has been modified, then follow the procedure in step 1, delete the line in the configuration file and restart the MySQL service, the new password will take effect.
Precautions
  • One copy can be copied as a backup before modifying the configuration file

  • Before restarting the MySQL service, it is best to disconnect the services associated with MySQL to avoid data loss.

MySQL forgot password under Linux

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.