What should I do if I forget the MySQL Root Account Password?

Source: Internet
Author: User

If you forget the MySQL Root Account Password, do not worry. Use the following steps to reset a new password:

  1. First stop the MySQL service "/etc/init. d/MySQL stop"
  2. Run the following command to start MySQL and disable user permission check:
    Mysqld_safe -- skip-grant-tables

    Remember, when you use this parameter to start the service, anyone can connect to MySQL without a password and have the highest permissions, so you need to be sure that you are in the process of doing this, do not allow others to access the database. You can use the following command to reject Network Connections:
    Mysqld_safe -- skip-grant-tables -- skip-networking
    In this way, you can only connect to the MySQL server through the local machine.
  3. Then use the mysql-u anything command to connect to MySQL
  4. Run the SQL statement: Update mysql. User SET Password = PASSWORD ('new-password') where user = 'root'
  5. Use the mysqladmin-u qualquer_coisa shutdown command to stop the MySQL service and start MySql in normal mode.
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.