Chitreshkr
Chitreshkr

Reputation: 191

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

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.sstatic.net/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.sstatic.net/tfFR6.jpg

Upvotes: 0

Views: 1350

Answers (3)

Boge-E
Boge-E

Reputation: 1

This problem boils down to administrator privileges. (I) don't use sudo commands in windows. Close the command prompt window, then run a fresh one as administrator and follow the exact procedure highlighted here: https://dev.mysql.com/doc/mysql-windows-excerpt/8.0/en/resetting-permissions-windows.html

Upvotes: 0

Liturghian Pope
Liturghian Pope

Reputation: 13

Manually creating a 'data' folder in the mysql installation folder seems to work. That's what the error says, it can't write into the data folder, most probably because it doesn't exist.

It's an old thread but I just encountered the same issue.

Upvotes: 1

nbk
nbk

Reputation: 49375

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.

Upvotes: 0

Related Questions