MySQL reset root password encountered pit (forgot password)

Source: Internet
Author: User

1 , principle

By configuring the parameter "Skip_grant_tables" to skip the grant_tables (authorization table) at MySQL startup, the root account password can be recharged by command

2 , Way

First you need to stop the MySQL service

(1 ) in My.ini file of [mysqld] block under Increase "Skip_grant_tables ", and then restart MySQL service, and then open cmd with Administrator privileges perform some column commands to reset the password

The steps are as follows:

A. Locate the My.ini file (right-click the MySQL service to find the executable path, search from your directory or Other level directory), and add "Skip_grant_tables" under the [MYSQLD] Block

B. Restart MySQL Service

C, open the cmd Command window with administrator privileges, execute mysql-uroot–p direct return without entering the password

D. Select database: Use MySQL

E, Update root password: Update user set Authentication_string=password (' New password ') where user= ' root ' and host= ' localhost '

F, Refresh permissions: Flush Privileges

G, exit: Quit

H, re-login: mysql-uroot-p Prompt to enter a password, then enter the password to log in

I, go back to the My.ini configuration file Remove "Skip_grant_tables", and then restart MySQL

(2 ) to specify parameters directly from the command "Skip_grant_tables "Start MySQL , and then execute the command change password (with 1 steps other than specifying the way to skip authorization table parameters are the same .

A, execute mysqld--defaults-file= "C:\ProgramData\MySQL\MySQL Server 5.7\my.ini"--skip-grant-tables---in the first cmd window Note the path (whichever is your actual situation)

Other steps Ibid.

Reference:

MySQL5.7 root password reset under Windows

80024706

Windows Mysql5.7 forgot root password solution

Https://www.cnblogs.com/yuwentims/p/9172463.html

3 , the pits encountered

The same way to modify the My.ini configuration "Skip_grant_tables" and then save it's important to note the encoded format "ANSI"

(1 ) with notepad++ will modify the My.ini the configuration

(2 ) Restart MySQL service, will not start (timeout), through the command to perform the next action will be reported "ERROR 1045 (28000): Access denied for user ' ODBC ' @ ' localhost ' (using Password:no)" the error

(3 the first thought is to go to Baidu, no fruit after the system event log to start, found some inexplicable other errors (in fact, part of the system is the error log of other programs):

A, first see according to the keyword is "service MySQL57 unexpectedly stop." This happened 7 times. "And no eggs to use

B, and then in the wrong next door looking for other errors "application-specific permission settings are not addressed to the user NT authority\local SERVICE sid (using LRPC) in address LocalHost that is not available in the application container unavailable sid (N/S 1-5-19) granted to the CLSID "like this shady wrong mind a fever and not much thought, then Baidu solves and no fart use

How to resolve:

Https://www.cnblogs.com/ibgo/p/3550674.html

http://www.ntxz.net/?p=580

Solved the log, but to MySQL did not affect, now only understand the wrong direction

(4 all event logs are purged and restarted computer

(5 finally found a mistake like "MySQL Start Error-- system error 2 found , the system cannot find the file specified "

How to resolve:

63262641?locationnum=4&fps=1

Resolved the error, the MySQL service can start the

Then executed the reset command, and finally reported a meaningful mistake. "Found option without preceding group in config file:xxx; Fatal error in defaults handling. ", found the original is the My.ini code mischief!

Change to ANSI, everything is going well ...

Reference:

MySQL Error: Found option without preceding group in config file:xxx; Fatal error in defaults handling.

56512606

MySQL reset root password encountered pit (forgot password)

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.