Derek Povah Derek Povah - 1 month ago 12
MySQL Question

Can't set root MySQL password to null

When installing mysql, I didn't put anything in the root password fields, but when I ran

mysql -u root
I still got
Access denied for user 'root'@'localhost'
.

I started mysql up in safe mode without the grant tables,
sudo mysql_safe --skip-grant-tables &
, then jumped in with
mysql -u root
without a problem.

Then I did
use mysql; update user set authentication_string=null where user='root';
and I got:

Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0


Anyone have any insight on why the password isn't updating?

Answer

I had to set the plugin to mysql_native_password, so the password reset part looks like this:

update user set authentication_string=password(''), plugin='mysql_native_password' where user='root'; FLUSH PRIVILEGES;
Comments