Skip to content
Advertisement

Access denied for user ‘root’@’localhost’ (using password: NO) – what’s wrong?

(Sorry for my English)

This is a log of my console:

anton@anton-X451CA:~$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
anton@anton-X451CA:~$ mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

What should I do? I understand that it appears when I try entering without a password, but I am dont confirmed password, and ‘root’/empty string doesn’t help.

Advertisement

Answer

When you installed this fresh, you usually execute

mysql_secure_installation

afterwards. There you also set the initial password for your root account (note, that this is not the root account you have in Linux).

When you installed version 5.7. or higher the initial password is not blank anymore. You can find it in the error log. Find this log by looking in your my.cnf file. Default directory is /var/log/mysql, I think.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement