Search code examples
mysqlmysql-error-1045

How to change root password to an empty one?


How can I change the root password to an empty one in MySql?

The following gives "Access denied for user 'root'@'localhost' (using password: YES)" error. I'm sure I've typed my password correct (it's only 123456)

mysqladmin -u root -p'123456' password ''

I've run this sql successfully but I can still access with my password 123456 and not with an empty one:

use mysql; update user set password=PASSWORD("") where User='root';

Solution

  • You need to FLUSH PRIVILEGES.