"Go" MySQL forgot root password solution

Source: Internet
Author: User
Tags mysql client

This article collects in my notebook, because cannot find the original source. Omitted in this, as if who knows can contact me plus.

Method One:
Under Windows:
1. Open the command Line (DOS) window and stop the MySQL service:

net stop MySQL

2. Under DOS, enter the bin directory under MySQL's installation path, such as D:\mysql\bin

3. Enter and execute the command:

Mysqld-nt--skip-grant-tables

(the window stops after this command executes)

4. also open a command-line window to execute MySQL

>  Use MySQL > Update User set Password=whereuser="root"; > Privileges ; > Exit

For example:

Open a command-line window

CD D:\mysql\bind:\mysql\bin>mysqld-nt--Skip-grant-tables

Also open a command-line window to execute MySQL

>  Use MySQL > Update User set Password=whereuser="root"; > Privileges ; > Exit

Method Two:

Solution to forgot MySQL Super admin root password under Windows
1, stop the MySQL service, CMD Open the DOS window, enter

net stop MySQL

2, in the CMD Command Line window, enter the MySQL installation directory such as

CD D:\MySQL\bin

3, skip the MySQL permissions check table, that is, when MySQL up, do not enter a password to enter the database.

The command is:

Mysqld-nt--skip-grant-tables

4. Reopen a CMD command-line window and enter

Mysql-uroot-p

, log in to MySQL using a blank password (without entering the password, press ENTER directly)

5, enter the following command to start modifying the root user's password

MySQL>update MySQL. User set Password=password (' new password 'whereUser= ' Root ';

6, Refresh the permissions table

MySQL>privileges;

7, exit

MySQL> quit

Client that resolves MySQL does not support authentication protocol
MySQL 5.1 uses a cryptography-based authentication protocol that is incompatible with protocols used by earlier clients (4.1). If you upgrade the server above 4.1, connecting with an earlier client may fail and give the following message:
The following is the referenced content:
shell> MySQL

Client does not support authentication protocol requested by server: Please consider upgrading the MySQL client.
To resolve this problem, use one of the following methods:
• Upgrade all client programs to use the 4.1.1 or the updated client library.
• When connecting to the server with a client prior to version 4.1, use an account that still has a style password of 4.1.
• For each user who needs to use the client before version 4.1, restore the password to the style prior to version 4.1. You can use the Set PASSWORD statement and the Old_password () function to accomplish this task:
The following is the referenced content:
mysql> SET PASSWORD for
-> ' some_user ' @ ' some_host ' = Old_password (' newpwd ');
You can also use the update and flush privileges:
mysql> UPDATE mysql.user SET Password = Old_password (' newpwd ')
-WHERE Host = ' some_host ' and User = ' some_user ';
mysql> FLUSH privileges;

"Go" MySQL forgot root password solution

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.