1

I'm having a serious troublesome situation trying to reset my MySQL's root password. I'm following the dev.mysql.com instructions:

Step 1. Log on to your system as Administrator.

Step 2. Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list and stop it. If your server is not running as a service, you may need to use the Task Manager to force it to stop.

Step 3. Create a text file containing the password-assignment statement on a single line. Replace the password with the password that you want to use.

MySQL 5.7.6 and later:

  ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

MySQL 5.7.5 and earlier:

  SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

Step 4. Save the file. This example assumes that you name the file C:\mysql-init.txt.

Step 5. Open a console window to get to the command prompt: From the Start menu, select Run, then enter cmd as the command to be run.

Step 6. Start the MySQL server with the special --init-file option (notice that the backslash in the option value is doubled):

C:\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
C:\> mysqld --init-file=C:\\mysql-init.txt***

That's where I'm stuck: step 6. I did everything accordingly, and cmd gives me back:

    mysqld: CAN'T CHANGE DIR TO 'C:Program Files\MySQL\MySQL SERVER 5.7\data\'
 <Errcode: 2 - No such file or directory>

    0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
 Please use --explicit_defaults_for_timestamp server option<see documentation for more details>

    0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 

...

PS: I've saved the mysqld-init.txt in the Local Disk(C:).

Please guys, I don't have a clue on how to solve this mess. I need to reset the root password and connect MySQL.

Thanks

t.niese
  • 39,256
  • 9
  • 74
  • 101
Marcos
  • 39
  • 6

1 Answers1

4

This question is about half a year old, but I just ran into the same problem this morning. Made several changes at the same time, so I'm not sure which was the actual fix, but, regarding:

mysqld: CAN'T CHANGE DIR TO 'C:Program Files\MySQL\MySQL SERVER 5.7\data\'

I created an empty 'data' directory in the "MySQL SERVER 5.7" folder. Additionally, I used an 'Administrator: Command Prompt' to execute the command. Finally, I included the "defaults file" specified in the MySQL docs, and fiddled with the order of inputs. I've closed the window now, but I don't believe I actually used "double backslashes".

My working command was:

mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini"
           --init-file="C:\Users\Me\mysql-init.txt"
           --console
Lovethenakedgun
  • 731
  • 6
  • 22