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.
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;
- 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
- login as root and start mysql using
mysql> set password = password('');
Done! No root password.
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
This worked for me on Ubuntu 16.04 with v5.7.15 MySQL:
First, make sure you have mysql-client installed (sudo apt-get install mysql-client
).
Open terminal and login:
mysql -uroot -p
(then type your password)
After that:
use mysql;
update user set authentication_string=password(''), plugin='mysql_native_password' where user='root';
(tnx @Stanislav Karakhanov)
And the very last important thing is to reset mysql service:
sudo service mysql restart
You should now be able to login (without passsword) also by using MySQL Workbench.