Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL root password does not work in Windows

I have tried all of the other solutions on this site.. they all seem to be the same anyway.

  1. Kill server via Task Manager, then restart it using the ./mysqld --skip-grant-tables option.

  2. PS C:\Program Files\MySQL\MySQL Server 5.6\bin> ./mysqld --init-file='C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql-init.txt'

    mysql-init.txt:

    UPDATE mysql.user SET Password=PASSWORD('root') WHERE User='root';
    FLUSH PRIVILEGES;
    
  3. Restart the mysqld

  4. PS C:\Program Files\MySQL\MySQL Server 5.6\bin> ./mysql --user=root -p

    Enter password: ****
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    

I can access the server with --safe --skip-grant-tables enabled, but that does not do me any good as changing the password there changes it in the tables for sure, however it does not allow me to log in just the same.

Does anyone know what I am doing wrong?


Edit:

Attempted the same procedure with following changes:

  1. Kill server via Task Manager, then restart it using the ./mysqld --skip-grant-tables option.

  2. PS C:\Program Files\MySQL\MySQL Server 5.6\bin> ./mysqld --init-file='C:\\Program Files\\MySQL\\MySQL Server 5.6\\bin\\mysql-init.txt'

  3. Start mysqld

  4. PS C:\Program Files\MySQL\MySQL Server 5.6\bin> ./mysql --user=root -p

    Enter password: **** ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Note: I tried this solution with and without the ./mysqld --skip-grant-tables option.

Is there some other error that I could be making or something that is a possible cause this procedure is not working. I heard something about making sure the innodb tables directory was correct.... but I cannot find more information on that. Additionally my install did not include ODBC Connector as I did not have the proper software installed for it.


Edit2:

./mysqld --skip-grant-tables

./mysql -u root -p Enter password: ****

~

mysql> select * from user where user='root'\G *************************** 1. row *************************** Host: % User: root Password: *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B Select_priv: Y Insert_priv: Y Update_priv: Y Delete_priv: Y Create_priv: Y Drop_priv: Y Reload_priv: Y Shutdown_priv: Y Process_priv: Y File_priv: Y Grant_priv: Y References_priv: Y Index_priv: Y Alter_priv: Y Show_db_priv: Y Super_priv: Y Create_tmp_table_priv: Y Lock_tables_priv: Y Execute_priv: Y Repl_slave_priv: Y Repl_client_priv: Y Create_view_priv: Y Show_view_priv: Y Create_routine_priv: Y Alter_routine_priv: Y Create_user_priv: Y Event_priv: Y Trigger_priv: Y Create_tablespace_priv: Y ssl_type: ssl_cipher: x509_issuer: x509_subject: max_questions: 0 max_updates: 0 max_connections: 0 max_user_connections: 0 plugin: authentication_string: password_expired: N 1 row in set (0.00 sec)

like image 777
rustysys-dev Avatar asked Jun 02 '14 13:06

rustysys-dev


1 Answers

Solved:

I had previously installed MySQL once before on this machine, unfortunately it seems it was never fully uninstalled and... I would assume the previous grant-tables were interfering with the installation. I fully removed everything in regards to MySQL and reinstalled it. It seems to be working fine for the time being. I will be attempting to change the password soon in order to make sure.... I changed the password and it worked as expected this time.

Lesson learned = Make sure to delete everything from previous installations. Do not just trust the installer to remove everything

like image 78
rustysys-dev Avatar answered Oct 28 '22 22:10

rustysys-dev