- 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.
-
-
Save pishangujeniya/0f839d11a7e692dadc49821c274a2394 to your computer and use it in GitHub Desktop.
hi sir, using mysql 8.0 on win 7 standalone pc
i tried as per png file attached
unable to reset the root pwd
i am a very very new to this software
Thanks in advance.
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --console --skip-grant-tables --shared-memory
2022-10-29T07:15:03.176856Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.20) starting as process 2920
2022-10-29T07:15:03.176857Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test
2022-10-29T07:15:03.176858Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test
2022-10-29T07:15:03.176859Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\Program Files\MySQL\MySQL Server 8.0\data' (OS errno: 2 - No such fileor directory)
2022-10-29T07:15:03.176860Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-29T07:15:03.176862Z 0 [System] [MY-010910] [Server] C:\Program Files\MyS
QL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.20) MySQL Com
munity Server - GPL.
@PhaniKumarDasika You need have a data
folder inside C:\Program Files\MySQL\MySQL Server 8.0\
this path. ref
Fails on
mysql -u root
withERROR 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (10061)
Don't close the previous cmd.
Fails on
mysql -u root
withERROR 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (10061)
Don't close the previous cmd.
Refere this
Thank you so much
-
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
This is just a test MySQL server that I have set up on my local machine. I was able to log in previously, but it has been a while and I cannot remember what I set my password to, so I am trying to reset it. I'm hoping someone might be able to help me out because I haven't been able to find anywhere online that has a solution.
I followed the steps in OPs post and can see that the password has been changed. However, as soon as I close out the cmd windows and try to log back in, I get an error that says access denied. I have also tried multiple other methods to change the password, and in all of those cases I am also told that my access is denied.
Thank you
Your Port of running MySQL Server might be different, or you need to start the MySQL Service as it might have been stopped.