MySQL root user password forgot what to do

Source: Internet
Author: User

  1. Modify the MySQL configuration file my.cnf, the path is/ETC/MY.CNF

  2. Write a line skip-grant-tables in the configuration file, save and exit after adding, as

    650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/79/74/wKioL1aR-HfzDOxdAAAZwP_l6kQ197.png "title=" Mysqld.png "alt=" Wkiol1ar-hfzdoxdaaazwp_l6kq197.png "/>

  3. After the completion of the addition, restart the mysqld, after the restart is complete directly with the root user login, you can go directly into the, this time do not need a password, haha

  4. Log in and quickly change the password to:

    mysql.user set Password=password ("123") where user= ' root ' andhost= '% ';

    Mysql>flush Privileges If you do not execute this after the change, quit mysql in or do not need a password, execution after the exit to enter the new password must be entered


    After changing the password, remember to change the configuration file back.


Note: When you go in and change your password, Don't use s et Password=password ("123"); Such modification Oh, will error, error message as follows: Error 1290 (HY000): The MySQLServer is running with the-- Skip-grant-tables option so it cannot execute thisstatement

Probably the meaning is that in this skip-grant-tables option cannot execute this command, or you can use the update to change it.

This article is from the "I Just passing ah" blog, please be sure to keep this source http://justdb.blog.51cto.com/11092943/1733458

MySQL root user password forgot what to do

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.