Re-install MySQL password in Linux

Source: Internet
Author: User

1. First confirm that no other person on the server is connected to the MySQL database. Because during the resetting of the MySQL Root Password, the MySQL database is completely out of the password-free status, other users can also log on and modify the MySQL information at will.
2. Modify MySQL Logon Settings:
# Vi/etc/My. CNF
In the [mysqld] section, add skip-grant-tables.
For example:
[Mysqld]
Skip-grant-tables
Save and exit VI.
3. Restart mysqld
#/Etc/init. d/MySQL restart
4. log on to and modify the MySQL Root Password
#/Usr/local/MySQL/bin/MySQL
Mysql> use MySQL;
Mysql> Update user SET Password = PASSWORD ('new-password') where user = 'root ';

Mysql> flush privileges;
Mysql> quit
5. Modify the MySQL Logon Settings.
# Vi/etc/My. CNF
Delete the skip-grant-tables added to the [mysqld] section.
Save and exit VI.
6. Restart mysqld
#/Etc/init. d/MySQL restart

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.