How to set root password to null

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.


  • connect to mysql as user root (use one of the two following methods)
    • login as root and start mysql using mysql -p, enter current root password
    • login as self and start mysql using mysql -u root -p, enter current root password
  • mysql> set password = password('');

Done! No root password.


If you want an empty password, you should set the password to null and not use the Password hash function, as such:

On the command line:

sudo service mysql stop
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -uroot

In MySQL:

use mysql;
update user set password=null where User='root';
flush privileges;
quit;