What should I do if I forget the root password of Mysql ?, Mysqlroot Password

Source: Internet
Author: User

What should I do if I forget the root password of Mysql ?, Mysqlroot Password

Sometimes I forget the root password of mysql. In this case, how can I reset the root password?

Find and edit the my. ini configuration file of mysql, and add skip-grant-table to the mysqld node as follows:

[Mysqld]
# These let you safely reset the lost root password.
Skip-grant-table

Save the changes and restart the mysql service.

Now you can connect to the database without the root password. Then, execute the following update:


USE mysql;
UPDATE USER
SET password = password ('yournewpasswordhere ')
Where user = 'root'
AND host = 'localhost ';

In this way, the root password is changed. At this time, delete the skip-grant-table in my. ini and restart mysql service.

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.