How to reset the MySQL root (root) password under Redhat Linux (CentOS)

Source: Internet
Author: User
Tags safe mode



1. First enter "service mysqld status" To view the current MySQL service status, showing that the MYSQLD service is running.





2. Enter the "killall-term mysqld" command to stop all mysqld processes.





3. Enter the "Service mysqld Stop" command to stop the MYSQLD service.





4. Enter "Mysqld_safe--skip-grant-tables &" command to enter MySQL Safe mode without password.





5. Enter "Mysql-u root" and press ENTER.






6. Enter "use MySQL;" Mount the database.



Note: Do not forget to enter a semicolon (;) at the end.





7. Enter "Update user set Password=password (" Redhat ") where user= ' root ' to change the root password to new9ssw0rd.





8. Enter "flush privileges;" Update permissions.





9. Enter "Quit" and press ENTER to exit.



Note: You do not need to enter a semicolon here.




10. Enter "Service mysqld restart" to restart the mysqld services.





11. Enter "Mysql-u root-p" and press ENTER to prompt for the password.





12. Enter the new password Redhat and press ENTER to indicate that you have successfully logged in.






How to reset the MySQL root (root) password under Redhat Linux (CentOS)


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.