Reset the password for the root account of MySQL

Source: Internet
Author: User


Method One:

In the My.ini [mysqld] field, add:

Skip-grant-tables

Restart the MySQL service when MySQL does not require a password to log in to the database

And then into MySQL.

Mysql>use MySQL;

mysql> Update user Set Password=password (' New password ') WHERE user= ' root ';

Mysql>flush privileges;

After running, finally remove the My.ini in the Skip-grant-tables, restart mysqld can be.


Method Two:

Do not modify the MySQL password by using the non-service mode plus skip-grant-tables to run MySQL without modifying the My.ini method of restarting the service

Stop MySQL Service

Open a command-line window and start with Mysqld-nt.exe in the bin directory, which is executed at the command-line window: Mysqld-nt--skip-grant-


Tables

Then open a command-line window, log in to MySQL, no need to enter the MySQL password to enter.

After modifying the password as above, close the command line to run the MySQL window, this time the MySQL is turned off, if you find that MySQL is still running


The corresponding process can be closed by closing.

Start the MySQL service


This article is from the "MySQL Basic Notes" blog, reproduced please contact the author!

Reset the password for the root account of MySQL

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.