Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change root password to an empty one? [duplicate]

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';
like image 1000
dstr Avatar asked Feb 25 '10 17:02

dstr


People also ask

How do I change the root password in SQL?

Create a text file containing the password-assignment statement on a single line. Replace the password with the password that you want to use. ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'; Save the file.


2 Answers

You should restart the MySQL server or run the following command:

FLUSH PRIVILEGES;

MySQL doesn't immediately "see" the changes you make to the tables containing user account data, hence the need for this additional step.

like image 141
pako Avatar answered Sep 21 '22 00:09

pako


You need to FLUSH PRIVILEGES.

like image 35
soulmerge Avatar answered Sep 20 '22 00:09

soulmerge