Getting error while trying to reset forgot root password in MySQL8?

0

Issue

I tried most of the troubleshooting steps available online .But I am not getting the solution.I forgot my root password .I tried creating the init file and loaded with data given online and tried it with cmd prompt .Then I tried using update commands to remove the password

Error snaps -> https://i.stack.imgur.com/tfFR6.jpg

(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\chitr>cd C:\Program Files\MySQL\MySQL Server 8.0\bin

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld.exe -u root --skip-grant-tables
2019-11-11T18:39:05.755671Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.18) starting as process 11668
2019-11-11T18:39:05.758635Z 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
2019-11-11T18:39:05.758740Z 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
2019-11-11T18:39:05.758887Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno: 2 - No such file or directory)
2019-11-11T18:39:05.777215Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-11-11T18:39:05.777347Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql --version
mysql  Ver 8.0.18 for Win64 on x86_64 (MySQL Community Server - GPL)

C:\Program Files\MySQL\MySQL Server 8.0\bin>sudo systemctl stop mysql.service
'sudo' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\MySQL\MySQL Server 8.0\bin>sudo /etc/init.d/mysql stop
'sudo' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --console
2019-11-11T18:58:41.814544Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.18) starting as process 10004
2019-11-11T18:58:41.817402Z 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
2019-11-11T18:58:41.817505Z 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
2019-11-11T18:58:41.817645Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno: 2 - No such file or directory)
2019-11-11T18:58:41.833930Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-11-11T18:58:41.834045Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld  --init-file=C:\Program Files\MySQL\MySQL Server 8.0\bin --console
2019-11-11T18:59:31.764265Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.18) starting as process 13568
2019-11-11T18:59:31.767450Z 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
2019-11-11T18:59:31.767595Z 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
2019-11-11T18:59:31.767780Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno: 2 - No such file or directory)
2019-11-11T18:59:31.788066Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-11-11T18:59:31.788210Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p
Enter password: **********
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)```


  [1]: https://i.stack.imgur.com/tfFR6.jpg

Solution

You should have posted also which tutorials you used.

That from your log seems to be for linux.

Use this simple solution for windows

https://dev.mysql.com/doc/mysql-windows-excerpt/8.0/en/resetting-permissions-windows.html

And follow it to the letter.

Answered By – nbk

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More