Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I got a problem with mysql server Actually i am not sure im tring to install queXS cati app on my ubuntu desktop i installed mysql server and php5 and when im trying

mysql -u root 

it says

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

but it is okey to enter with mysql -u root -p

i couldn't figure it out what is the problem.

share|improve this question
Try this: mysql -u root -p mysql Enter password: and you will get: mysql> –  user273774 Apr 24 '14 at 18:47

3 Answers 3

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.

share|improve this answer

In simple words your "root" session do not know password to mysql root user.

If you want to make easier to access your mysql

create .my.cnf in /root/

and put in it

 user = root
 password = mysqlrootpassword
 user = root
 password = mysqlrootpassword
 user = root
 password = mysqlrootpassword

where offcourse mysqlrootpassword is your password for mysql's root password so when you execute mysql it uses this password

Remeber about safety of this file - put secure rights, so nobody on your server can read it!

share|improve this answer

Login to webmin and under servers, access the mySQLdatabase server.You will then be able to set the (user) password provided you have:

mysql -u (**user**) -p < /usr/share/doc/rsyslog-mysql-5.8.10/createDB.sql.

The web gui is easy but to be secure use the terminal.


share|improve this answer

protected by Community Dec 4 '14 at 13:50

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.