- Stop the
MySQL 8.0
service from services - Go to path C:\Program Files\MySQL\MySQL Server 8.0\bin and open
cmd
- Run
mysqld --console --skip-grant-tables --shared-memory
- Open new
cmd
in the same path - Run following commands
mysql -u root
select authentication_string,host from mysql.user where user='root';
UPDATE mysql.user SET authentication_string='' WHERE user='root';
- Now close both the
cmd
. - Try to start the MySQL 8.0 service.
- Connect using username as root & password as blank.
- Change the password from the user managerment.
Created
December 5, 2019 18:04
-
-
Save pishangujeniya/0f839d11a7e692dadc49821c274a2394 to your computer and use it in GitHub Desktop.
Reset MySQL 8.0 root Password in Windows
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stop MySQL Service @ services.msc
Create file change_mysql_pwd.txt with following content (replase YourNewPassword with desired new password you want to have for root user:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourNewPassword';
Save the file under C:\ change_mysql_pwd.txt
Run CMD.exe as Admin (Start->Cmd->Right Click->Run as Administrator)
Type in cmd: cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
Create “Data” Folder under "C:\Program Files\MySQL\MySQL Server 8.0\ (if already exists delete its contents!)
Type in cmd: mysqld --install
Type in cmd: mysqld --initialize
Type in cmd: mysqld --init-file=C:\change_mysql_pwd.txt
Login with root user account and the password set above.
Delete C:\ change_mysql_pwd.txt file