MySQL forgot password what to do?

Source: Internet
Author: User

Windows:
1. Log into the system with the system administrator.
2. Stop the MySQL service.
3. Go to the Command window and enter the MySQL installation directory, for example, my installation directory is c:mysql, enter C:mysqlbin
4. Skip permission Check to start MySQL,
C:mysqlbin>mysqld-nt–skip-grant-tables
5. Reopen a window, enter the C:mysqlbin directory, and set a new password for root
C:mysqlbin>mysqladmin-u root flush-privileges password "NewPassword"
C:mysqlbin>mysqladmin-u root-p shutdown
Replace the newpassword with the root password you want to use, and the second command will prompt you to enter a new password and repeat the password entered by the first command.
6. Stop MySQL Server and start MySQL in normal mode
7. You can link to MySQL with a new password.

Unix&linux:
1. Log in to the system with root or user running mysqld;
2. Use the KILL command to end the process of losing mysqld;
3. Starting MySQL Server with the –skip-grant-tables parameter
Shell>mysqld_safe–skip-grant-tables &
4. Set a new password for [email protected]
Shell>mysqladmin-u root flush-privileges password "NewPassword" 5. Restart MySQL Server

GRANT all privileges on * * to [e-mail protected]% identified by ' 123′

How to solve Linux:
Turn off MySQL
Then, Safe_mysqld–skip-grant-tables
Start MySQL.

Mysql-u Root
mysql> use MySQL
mysql> UPDATE user SET password=password (' xxx ') WHERE user= ' root ';
mysql> FLUSH privileges;

MySQL forgot password what to do?

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.