How to modify the root password of a mysql database

Source: Internet
Author: User

1. Shut down the mysql database you are currently running. You can either end the mysql process or directly close the mysql server.

2. Close the database and click Run to start running. Enter cmd to enter the command line window. In this command line, enter the installation path of your database, if it is installed by default, it will be in c: \ Program Files \ MySQL Server 5.0 \ bin

3. Enter mysqld -- skip-grant-tables in this path and press Enter. This command means to start the database in safe mode.

4. If the above steps are successful, a small cursor will appear in the cmd window, and no prompt will pop up. This indicates that your database has been started, in this case, re-open a cmd window, enter the installation path of the mysql database, and enter mysql-uroot-p. This command means to log on to MySQL with a blank password, if it succeeds, you will see a prompt such as mysql>. At last, enter update mysql. user set password = PASSWORD ('new password') where User = 'root ';

In the new password, enter the password you want to modify, close all cmd windows, follow the first step to turn off your server, and then run your server again in the normal step, at this time, your root password is changed to the new password you just set.

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.