Dry----004----MySQL forgot the root password?

Source: Internet
Author: User
What if MySQL forgets the root password?

What if MySQL forgets the root password? In general, there are two ways of thinking: Retrieve the password and reset the password. In the actual work, the MySQL database forgot the root password is generally used to reset the password method to solve. Here's a look at the steps to reset the root password under Linux and under Windows.

What happens when MySQL forgets the root password under Windows?
1. Log on to the system as a system administrator and start the MySQL skip permission check.
D:\mysql\bin\mysqld-nt–skip-grant-tables

2. Go to D:\mysql\bin and set the password using the mysqladmin command
D:\mysql\bin\mysqladmin-u root flush-privileges password "new password"

3. Restart MySQL in cmd
net start MySQL

What if MySQL forgets the root password under Linux?
1. Start MySQL with the following command to start without checking permissions;
[Email protected] mysql]# Safe_mysqld–skip-grant-tables &
[Email protected] mysql]# Mysqld–skip-grant-tables &

2. Then log in to MySQL using the root user with a blank password
[Email protected] mysql]# mysql-u root

3. Change the password of the root user;
mysql> Update Mysql.user Set Password=password (' New password ') where user= ' root ';
mysql> flush Privileges;
Restart MySQL and you will be able to log in with your new password.

Dry----004----MySQL forgot the root password?

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.