Reset the root password of the MySQL database (linux/windows)

Source: Internet
Author: User
In linux and windows, you can reset the mysql user name and password. For more information, see.

In linux and windows, you can reset the mysql user name and password. For more information, see.

(1) Linux
Run the following command in SSH to reset the MySQL password to diavps.
The Code is as follows:
Rm-f reset-mysql-root-password.phps
Wget http://down.hostwiki.info/mysql/reset-mysql-root-password.phps
Php reset-mysql-root-password.phps (diavps)

Do not use this method in an environment with a Management Panel (such as Kloxo or DA.
The command for starting MySQL in safe mode in line 1 of the script varies depending on the MySQL installation path.
The mysql service name used in the script is mysqld. In some systems, this service name may be mysql. Please modify it.

(2) Windows
1. Stop the running MySQL process

Net stop mysql

If it is not loaded as a service, you can close it directly in the Process Manager.

2. Start MySQL in Safe Mode
Run

X:/MySQL/bin/mysqld-nt.exe -- skip-grant-tables

3. You will be able to access MySQL without a password.

X:/MySQL/bin/mysql-u root-p
Enter the password and press Enter.

4. Change the password

> Use mysql
> Update user set password = password ("new password") where user = "root ";
> Flush privileges;

5. Start MySQL
Close all MySQL processes in the task manager and start them with the following command.

Net start mysql

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.