MySQL forgot root password solution

Source: Internet
Author: User

Linux under mysql forgot root password can skip safe mode into mysql change root password;

First turn off the MySQL services,serviceMySQL stop

Then find the mysql configuration file my.cnf,

In the mysqld configuration, add:skip-grant-tables;

Restart mysql service

MySQL Stop

MySQL Start

You can enter MySQL with a blank password.

Modify root password:update user set Password=password ("New_pass") where user= ' root ';

Then comment out the previous line;

MySQL is normally used.

Windows mysql forgot root password can skip safe mode into mysql change root password;

First turn off the MySQL service;

Then go to the MySQL installation directory on the cmd command line : (for example, installing the D:\phpStudy\MySQL\bin directory);

Enter D: and Enter the d directory

Input CD "D:\phpStudy\MySQL\bin" enter into the installation directory

Enter mysqld-nt--skip-gtant-tables Enter no password mode

Reopen a CDM command interface;

Input mysql-u root-p

Enter MySQL to change the root password;

Modify command:update mysql.user set Password=password (' new password ') where user= ' root ';

MySQL forgot root password solution

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.