2

Windows force restarted on me yesterday right after setting up MySQL and popSQL, now, mySQL is telling me my password - that I know is right - is incorrect. I'm trying to reset the root password, but literally none of the guides have worked.

I've tried the official guide here, but I get a couple of errors, it does not reset the name.

The errors are:

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --init-file=C:\\mysql-init.txt

2019-02-19T16:44:49.460933Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.15) starting as process 8864

2019-02-19T16:44:49.464194Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\DESKTOP-2DUTV5J.lower-test

2019-02-19T16:44:49.464260Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\DESKTOP-2DUTV5J.lower-test

2019-02-19T16:44:49.464399Z 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-02-19T16:44:49.478891Z 0 [ERROR] [MY-010119] [Server] Aborting

2019-02-19T16:44:49.479009Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.15)  MySQL Community Server - GPL.

How can I fix this? I just want to reset my password.

BEFORE THE MOD MARKS THIS AS A DUPLICATE, UNLIKE THE LINKED THREADS, I'M NOT USING PHP, UNIX, XAMPP OR .BATs......... and half the links in that thread are dead. I've tried their solutions, they did not work. It's clear my issue is unique.

I've also included the 'name-installed' log file

bignose
  • 30,281
  • 14
  • 77
  • 110
kaio37k
  • 21
  • 3
  • 1
    Hi, welcome to StackOverflow. The error message 'Failed to set datadir to 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno: 2 - No such file or directory)' is surely a good place to start. What's happened to this directory? Do you have an access problem perhaps - have you tried running as administrator? – MandyShaw Feb 19 '19 at 20:42
  • @MandyShaw Thanks! The only `data` folder in any of the SQL directories is in `ProgramData`, there isn't a `data` in Program Files. I'm guessing I should somehow change where it's looking? For clarification, the `data` is in the same directory as the `my.ini`. – kaio37k Feb 19 '19 at 20:57
  • If this was working before the restart, I can't see why the configuration should need changing. I'd be inclined to try a reinstall. – MandyShaw Feb 19 '19 at 21:04
  • @kaio37k Looks like your "my.ini" file isn't found at the correct location and maybe mysql finds a different one, which has also incorrect data. Please check https://stackoverflow.com/questions/14597884/mysql-my-ini-location and test/verify that "mysqld" is using the correct "my.ini" file. Also check the environment variable `%PROGRAMDATA%`. – Progman Feb 19 '19 at 23:09

3 Answers3

2

According to the MySQL 8 docs, if you used the wizard to install MySQL, you have to specify the .ini file like this:

C:\> mysqld
     --defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 8.0\\my.ini"
     --init-file=C:\\mysql-init.txt

There was not a need to create the data folder (however, doing so did remove some of the errors, but not all).

  • I'm not sure if the flag to the defaults-file also corrects the data-dir. It is probably safer to do: mysqld --init-file="C:\newsql.txt" --datadir="C:\ProgramData\MySQL\MySQL Server 8.0\Data" --console – Ambiwlans Oct 29 '21 at 04:26
0

All you have to do is manually create data folder on C:\Program Files\MySQL\MySQL Server 8.0\ path.

Abdelwahed
  • 17
  • 2
0

I had an issue with logging in so I tried to reset the password and got this same error. From what I understood this happens because MySQL server daemon is looking for the my.ini in C:\Program Files\MySQL\MySQL Server 8.0\data\, which in my case, was not there. my.ini is originally in the Data directory in C:\ProgramData\MySQL\MySQL Server 8.0.

Try copying the whole Data directory from C:\ProgramData\MySQL\MySQL Server 8.0 into C:\Program Files\MySQL\MySQL Server 8.0\

Turned out the logging in issue I had was also due to the missing Data directory. I don't know how the Data directory went missing in the first place or whether copying the same Data directory from C:\ProgramData\MySQL\MySQL Server 8.0 would result in some kind of a clash in configuration settings later on, but to this date it all seems to be working fine. If someone knows why this happened or is there any other proper solutions for this matter, kindly let me know too

R0KKET
  • 55
  • 2
  • 7
  • 1
    mysqld --init-file="C:\newsql.txt" --datadir="C:\ProgramData\MySQL\MySQL Server 8.0\Data" --console Is how you point to the datadir without just moving it – Ambiwlans Oct 29 '21 at 04:25