How to set root password to null

Stormshadow picture Stormshadow · Jan 20, 2010 · Viewed 154.2k times · Source

How can I change the password for root user of MySQL to null -- meaning no password or '' -- from the MySQL command line client?

Answer

Stanislav Karakhanov picture Stanislav Karakhanov · Mar 26, 2016

Worked for me and "5.7.11 MySQL Community Server":

use mysql;
update user set authentication_string=password(''), plugin='mysql_native_password' where user='root';

I had to change the 'plugin' field as well because it was set to 'auth_socket'.

After that I could connect as mysql -u root without a password.