Changin MySQL Root Password

Hi,

I am a beginner to MySQL and trying to follow Kevin’s book. I installed Apache, PHP and MySQL without any problem. I changed the root password using this line:

mysqladmin -u root -p password "newpassword"

Now, when I open MySQL Command Line Client, I can login with my password and it gives error when I type something different other than the password. However, I can also login without typing any password. Is this normal? Is this what it is supposed to be?

Try restarting your MySQL server to ensure it picks up on the new changes.

When you say that you can login without a password, what commands are you using?

Can you select a database and perform a simple SQL command e.g. select * from <table_name> ?

Wil.

To restart MySQL:

/etc/init.d/mysql restart

If that doesn’t solve it, try (in MySQL):

SET PASSWORD FOR ‘root’@‘localhost’ = PASSWORD(‘mypass’);

Then restart MySQL again.

If that doesn’t work, then try:

SET PASSWORD FOR ‘root’@‘%’ = PASSWORD(‘mypass’);

And restart again lol.

Thank you both, restarting the system worked. Now it doesn’t login without entering my password.