A Step-by-Step Guide to Resetting Your Forgotten MySQL Password
STEP 1
Search ‘services’ on your computer
Search mysql on ‘services’ window now
Double click on mysql to open
Change ‘startup type’ to ‘disable’
Now Click ‘stop’ button ( if enabled)
Click apply then click OK
STEP 2
Now create a ‘txt’ file in any disk and name it something like ‘computer’
You have to write this code in this ‘txt’ file
USE MYSQL ; UPDATE mysql.user SET Password = PASSWORD('Set_Your_New_Password') WHERE User = 'root' ; FLULSH PRIVELEGES ;
After writing this code save the ‘txt’ file
STEP 3
Now you have to go to the Folder of “program file”
Now you have to go to the Folder of “Mysql”
Now go to mysql server
got to folder ‘bin‘
copy location of ‘bin’ folder
location of bin folder
C:\Program Files\MySQL\MySQL Server 8.0\bin\
STEP 4
now Open ‘command prompt’ CMD
Type ‘cd’ in ‘command prompt’ CMD and give space and paste the location of bin folder and press Enter key
STEP 5
Now you have to copy this code
mysqld --defaults-file="location_1" --init-file=location_2
Paste this Code in ‘command prompt’ CMD
STEP 6
Now you have to go to the Folder of “programData” in C Drive
Now you have to go to the Folder of “Mysql”
Now go to mysql server
Copy the location of my.ini file
The location of the file ‘my.ini’ is something like
C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
Now Replace ‘\’ backward slash with‘\\’ double backward slash in the location of my.ini file
The new location of the file ‘my.ini’ is something like
C:\\ProgramData\\MySQL\\MySQL Server 8.0\\my.ini
Now Copy This location C:\\ProgramData\\MySQL\\MySQL Server 8.0\\my.ini
mysqld --defaults-file="location_1" --init-file=location_2
and replace location_1 with C:\\ProgramData\\MySQL\\MySQL Server 8.0\\my.ini in the command prompt
Now Copy the Location of the ‘TXT’ File And replace with location_2
code
mysqld --defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 8.0\\my.ini" --init-file=C:\computer.txt
Now Press enter Key
wait for 5 seconds
Now CLOSE command prompt
Restart Your Computer
Search ‘services’ on your computer
Search mysql on ‘services’ window now
Double click on mysql to open
Now Click ‘start’ button ( if Disabled)
Click apply then click OK
Now Open Your Mysql With Your New Password 😎
Tags
How to Change Password of MySQL || How to reset MySQL Password | mysql password reset | Forgot mysql password