MySQL database forgot root password

Source: Internet
Author: User

Depends on what you are in the system (Windows or Linux) under the MySQL, in general, the method is to open unsafe mode into MySQL, and then directly modify the MySQL database under the user table, remember update user set password= Password ("New password") where user= "root"; I wrote a meaning, password ("New password"), password () is a cryptographic function, not directly password= "new password"; Refer to the online tutorial, try it yourself, If you don't understand, ask again. Give it to me first. If you are prompted that MySQL is not a valid command, go to the bin directory below the directory of MySQL and then proceed or add it to the environment variable.


    1. Ensure that the MySQL service is turned off, and if you have registered the service, use the command: net stop MySQL;

    2. Turn on unsafe mode, that is, without permission verification (password Authentication), you can enter MySQL arbitrarily, using the command: Mysqld-nt--skip-grant-tables

    3. Update Mysql.user set Password=password (' New password ') where user= ' root ' and host= ' localhost ';

    4. Key step: Refresh permissions, using command: Flush privileges;

    5. Close the command line,

    6. Kill the Mysqld process, method: Go to the Task Manager and end the process Mysqld.exe.

    7. Start MySQL service again, using the command net start MySQL.


This article is from the "Dusk Prayer" blog, please be sure to keep this source http://ailoveai5521.blog.51cto.com/3381210/1685318

MySQL database forgot root 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.