Reset the Mysql database root password (linux/windows) _mysql

Source: Internet
Author: User
Tags mysql in
(1) Linux system
You can reset the MySQL password to Diavps by executing the following command in SSH
Copy Code code 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

Be careful not to use this method to reset in an environment with a management panel such as Kloxo or DA.
The command to start MySQL in Safe mode on line 13th of the script will vary depending on the MySQL installation path.
The MySQL service name used in the script is mysqld, the service name may be MySQL in some systems, please note the modification.

(2) Windows system
1, first stop the running MySQL process

net stop MySQL

If it is not loaded as a service, it can be shut down directly in the process manager.

2. Start MySQL in safe mode
Run at the command line

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

3, after the completion of the password can not enter the MySQL

X:/mysql/bin/mysql-u root-p
When prompted to enter a password, you can return directly.

4. Change Password

>use MySQL
>update User Set Password=password ("New password") where user= "root";
>flush privileges;

5. Start MySQL
In Task Manager, close all MySQL processes and start using 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.