MySQL Recover password

Source: Internet
Author: User
Tags mysql login

1, first confirm the server out of security state, that is, no one can arbitrarily connect to MySQL database. Because the MySQL database is completely out of password-protected state during the reset of the root password of MySQL, other users can log in and modify the MySQL information arbitrarily. It is possible to implement the server's quasi-security state by enclosing MySQL's external ports and stopping Apache and all user processes. The safest state is to operate on the console of the server and unplug the network cable.
2, modify the MySQL login settings;

Vim/etc/my.cnf

Add one sentence to the paragraph in [mysqld]: Skip-grant-tables Save and exit Vim.
3. Restart mysqld;

Service mysqld Restart # or/etc/init.d/mysqld restart
4, log in and modify the root password of MySQL;
1.mysql>; Use MySQL;2.mysql>; UPDATE user SET Password = Password (' New-password ') WHERE user = ' root ';3.mysql>; Flush Privileges;4.mysql>; Quit

5, the MySQL login settings to change back;

Vim/etc/my.cnf

Delete the skip-grant-tables that was added in the paragraph of [mysqld] just now;
Save and exit Vim.
6, restart mysqld;

Service mysqld Restart # or/etc/init.d/mysqld restart

7, restore the normal working state of the server;
Reverse the action in step one. Restores the server's working status.

From: http://www.cnblogs.com/liangml/p/5972414.html

MySQL Recover password

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.