In short: my goal is to reset mysql root password on ubuntu.
Background: I set up a ubuntu desktop and installed LAMP stack last week. I then went to do something else, and just got back to carry on today. Either I did not set mysql password, or I have forgotten what I typed in.
So I tried to reset it.
I stopped mysql by
sudo stop mysql
I tried to start mysql using command line options, but it seems start only takes service name(??)
So I ran:
sudo /etc/init.d/mysql start --skip-network --skip-grant-tables
Went into mysql, fine. Then
mysql> UPDATE mysql.user SET Password=PASSWORD('newpasswd') WHERE User='root';
ERROR 1142 (42000): UPDATE command denied to user ''@'localhost' for table 'user'
mysql> show grants for ''@'localhost';
+--------------------------------------+
| Grants for @localhost |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+
1 row in set (0.00 sec)
If ''@'localhost' has USAGE on all-schemal.all-tables, I'd think I can just update the password like this... Where did I miss?
I used the instruction in mysql official website, the last part. I also tried the unix one but with no luck. And I was unsure when it says 'unix', does it mean all *nix system or just unix???
Anyway, any thoughts are welcome! many thx!!!