[Mysql] Common commands-forgot password

Source: Internet
Author: User

[Mysql] Common commands-forgot password

The previous article basically summarized how to create a user using commands in myql. For details, see [Mysql] Common commands-user operations (create, authorize, modify, and delete)

What should I do if I forget my password in special circumstances today ???

You can reinstall or delete configurations to complete this operation. What should I do if I don't reinstall it?

Principle:

Run -- skip-grant-tables to skip grant-tables to start the database.

Let's take a look at the following:

In linux:

1. Shut down the mysql process, such as service mysql stop or ps-ef | grep mysql kill (mysqlpid) and rcmysqld stop.

2. Add the startup parameter: You can edit/etc/my. ini or/etc/my. run the/usr/bin/mysqld_safe -- skip-grant-tables command to start mysql.

3. Enter the system without a password and change the password: mysql-u root-p.

The same is true for windows, but the operations are different.

1. Right-click my computer, choose "manage" service ", find mysql, stop mysql, run cmd with win + R, and run net stop mysql.

2. Use the -- skip-grant-tables parameter to start the database.

C: \ Users \ WJ> net stop mysqlMySQL service is stopping .. MySQL service has stopped successfully. C: \ Users \ WJ> mysqld -- skip-grant-tables
3. Use root to log on.

4. Stop or use this parameter again.

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.