Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When trying to restart my MySQL password I get the following output in the console (this is also the input that caused the output):

C:>"C:\MySQL\bin\mysqld" --console --init-file=C:\mysql--init.txt

111008 23:42:48 [Note] Plugin 'FEDERATED' is disabled.
111008 23:42:48 InnoDB: The InnoDB memory heap is disabled
111008 23:42:48 InnoDB: Mutexes and rw_locks use Windows interlocked functions
111008 23:42:48 InnoDB: Compressed tables use zlib 1.2.3
111008 23:42:48 InnoDB: Initializing buffer pool, size = 45.0M
111008 23:42:48 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file .\ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 24117248 bytes!
111008 23:42:48 [ERROR] Plugin 'InnoDB' init function returned error.
111008 23:42:48 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

111008 23:42:48 [ERROR] Unknown/unsupported storage engine: INNODB 
111008 23:42:48 [ERROR] Aborting

111008 23:42:48 [Note] C:\MySQL\bin\mysqld: Shutdown complete
share|improve this question
@random: I have added the info. – Dynamic Oct 3 '11 at 19:35
Number the steps, I am far to tired, to figure out which line is suppose to be step 6. – Ramhound Oct 3 '11 at 19:41
@Ramhound: The entire thing is step 6. – Dynamic Oct 3 '11 at 19:42
So have you created the init file and saved it there? What happens when you execute C:\mysql\bin\mysqld --init-file=C:\\mysql-init.txt? (Note that your edit only copied step 6 in there, you still haven't told us what you've tried!) – slhck Oct 3 '11 at 19:44
@slhck: I've tried every step before step six, then I get stopped there. – Dynamic Oct 3 '11 at 19:50

If you have followed the step in the manual you just need to execute the command:

C:\> C:\mysql\bin\mysqld --init-file=C:\\mysql-init.txt

Which automatically will reset the password (because you wrote the file with the command to do it (step 3)).

If this command doesn't work just execute the other command:

C:\> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld.exe"
        --defaults-file="C:\\Program Files\\MySQL\\MySQL Server 5.5\\my.ini"
share|improve this answer
Where do I execute this? – Dynamic Oct 3 '11 at 19:49
"From the Start menu, select Run, then enter cmd as the command to be run" after that you will see the cmd window and you have to put the command in. – DavidEG Oct 3 '11 at 19:55
I executed the first command. I got the following message: :\\mysql-init.txt 111003 16:20:43 [Warning] '--default-character-set' is deprecated and will be re moved in a future release. Please use '--character-set-server' instead. – Dynamic Oct 3 '11 at 20:21
So use the suggested command instead. – Ramhound Oct 5 '11 at 13:21

Manual says:

C. Resetting the Root Password: Windows Systems On Windows, use the following procedure to reset the password for all MySQL root accounts:

  1. Log on to your system as Administrator.
  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.
  3. Create a text file containing the following statements. Replace the password with the password that you want to use.

    UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES;

    Write the UPDATE and FLUSH statements each on a single line. The UPDATE statement resets the password for all root accounts, and the FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.

  4. Save the file. For this example, the file will be named C:\mysql-init.txt.
  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.
  6. Start the MySQL server with the special --init-file option (notice that the backslash in the option value is doubled):

    C:\> C:\mysql\bin\mysqld-nt --init-file=C:\\mysql-init.txt 

    If you installed MySQL to a location other than C:\mysql, adjust the command accordingly. The server executes the contents of the file named by the --init-file option at startup, changing each root account password. You can also add the --console option to the command if you want server output to appear in the console window rather than in a log file. If you installed MySQL using the MySQL Installation Wizard, you may need to specify a --defaults-file option:

    C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt.exe" --defaults-file="C:\\Program Files\\MySQL\\MySQL Server 5.0\\my.ini" --init-file=C:\\mysql-init.txt 

The appropriate --defaults-file setting can be found using the Services Manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list, right-click it, and choose the Properties option. The Path to executable field contains the --defaults-file setting. 7. After the server has started successfully, delete C:\mysql-init.txt.

So first you have to create file as stated in point 3 and then, using a command line (Start->Run->CMD(ENTER), run mysqld-nt.exe with --init-file param pointing to that file. Remember to use full path both for mysqld-nt.exe and your created file.

share|improve this answer
Ok, so how do I run mysqld-nt.exe? – Dynamic Oct 3 '11 at 19:54
Did you find mysqld-nt.exe installation directory? If yes, call it MYSQLDIR. Then run Start->Run->cmd and press ENTER. In the black window that appears, write "MYSQLDIR\mysqld-nt.exe" --init-file="full_name_txt_file_created_in_point_3" and press ENTER – Marco Oct 3 '11 at 19:57
I found mysqld.exe. Is the directory you talking about the one that holds this? – Dynamic Oct 3 '11 at 20:13
yes, the one I called MYSQLDIR is the one in which resides mysqld-nt.exe – Marco Oct 3 '11 at 21:30
I tried this with no luck. – Dynamic Oct 3 '11 at 22:59

In your case, before you can even reset the password, you need to fix the start up issue.

Note the first error listed in MySQL error log:

InnoDB: Error: log file .\ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 24117248 bytes!

This means that you may have copied your database files from another location or you have edited my.cnf settings and they no longer match the real ib_logfile0 file size. Focus on this issue first.

share|improve this answer
I wish I could upvote this 3 times because it's the only answer in this thread that is correct. Did anyone else even read the error message? – Aaron Brown Oct 19 '11 at 3:58
Thanks @AaronBrown! It looks like the question was heavily edited, so that would explain the answers from other people. – dabest1 Oct 19 '11 at 10:50
oops, you're right. My apologies to the other posters. – Aaron Brown Oct 21 '11 at 20:02

I answered a question just like this in the DBA StackExchange back on Sep 26, 2011.

This person accepted my answer.

It is like a hack of my.ini and it should work for you.

UPDATE 2011-10-19 07:12 EDT

All you have to do is delete ib_logfile0 and ib_logifle1, and mysqld will cause InnoDB to regenerate the two innodb log files.

I wish had seen the error log earlier. All this time I keep helping you solve the grants issues.

share|improve this answer
I get an error: system error 1067 has occurred when trying to start the MySQL service. – Dynamic Oct 5 '11 at 19:09
What does the error log say happened ??? – RolandoMySQLDBA Oct 5 '11 at 19:28
Error log? What error log? Please I'm very new to this. – Dynamic Oct 5 '11 at 20:29
By default, wherever the datadir of mysql is, there is a default error log which is usually hostname.err. – RolandoMySQLDBA Oct 5 '11 at 20:48
And where is the datadir usually placed? – Dynamic Oct 6 '11 at 0:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .