I tried your code with and without the "--skip-grant-tables" option. Both times the command failed.
MySQL started normally:
Code:
mysql>SET PASSWORD FOR root@'localhost' = PASSWORD('password');
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
MySQL started with --skip-grant-tables
Code:
mysql> SET PASSWORD FOR root@'localhost' = PASSWORD('password');
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
Then I tried updating the mysql.user table with a modified update query (where host was specified). See below:
mysql is running with --skip-grant-tables...
Code:
mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root' AND Host='localhost';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> SELECT User, Password, Host FROM mysql.user;
+------------------+-------------------------------------------+-------------+
| User | Password | Host |
+------------------+-------------------------------------------+-------------+
| root | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 | localhost |
| root | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 | osthelpdesk |
| root | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 | 127.0.0.1 |
| | | localhost |
| | | osthelpdesk |
| debian-sys-maint | *4FE45312C28AEF93B59F27609E333076D06C3454 | localhost |
+------------------+-------------------------------------------+-------------+
6 rows in set (0.01 sec)
mysql> exit
Bye
nonroot@osthelpdesk:~$ sudo /etc/init.d/mysql stop
* Stopping MySQL database server mysqld [ OK ]
nonroot@osthelpdesk:~$ sudo /etc/init.d/mysql start
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.
nonroot@osthelpdesk:~$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
nonroot@osthelpdesk:~$ mysql -u root -password password
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
nonroot@osthelpdesk:~$ sudo mysql -u root -password password
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Still not working...
Bookmarks