Somehow the root
password on my local installation of MySQL (Ver 8.0.30-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu))) isn't what I thought it was. Okay, quick search reveals that the step to reset it is to stop MySQL, restart it with mysqld_safe --skip-grant-tables
and go in and change the password. Okay, no big deal.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option
so it cannot execute this statement
What?!? I'm running with the --skip-grant-tables
option precisely because I was told to do so. Okay, let me try the other way:
mysql> UPDATE mysql.user SET authentication_string=PASSWORD('')
WHERE User='root' AND Host='localhost';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '(''),
plugin='mysql_native_password' WHERE User='root' AND Host='%'' at line 1
Why does everyone say to use --skip-grant-tables
if ALTER USER
doesn't work under it? What is wrong with the UPDATE
statement? And what's the best way to fix this situation?
(BTW, this server isn't and won't be exposed outside of our organization, so I don't need the lecture about the password being empty.)
FLUSH PRIVILEGES;
UPDATE mysql.user SET plugin='mysql_native_password' WHERE User='root';
ALTER USER 'root'@'localhost' IDENTIFIED BY '';
Restart machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With