Ubuntu – ERROR 1045(28000) : Access denied for user ‘root@localhost’ (using password: no )

MySQLpermissions

I'm trying to install queXS cati app on my Ubuntu desktop and I installed MySQL server and PHP 5 and I cannot login into MySQL server as root without password:

mysql -u root 

it says

ERROR 1045(28000) : Access denied for user 'root@localhost' (using password: no )

But it's okay when I enter mysql -u root -p

I can't figure out what the problem is.

Best Answer

Add switch -p for password based login:

mysql -u root -p

That is the normal behaviour. You set a root password for your database so from now on you can't access it without password. That is why it reports:

Access denied for user 'root@localhost' (using password: no )

Obviously when you give the password with the -p switch you succeed.