Search code examples
mysqlmysql-error-1045

Beginner MYSQL Error - Access Denied


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

I've tried EVERYTHING, I've read through pages of answers and no-one seems to know the right one.

When i try to log into my DB i just get the above error, I havent set a password or anything.

Can't log into MySQL at all now, don't understand.

Thanks for your help in advance


Solution

  • use the -p option. (Tells mysql that you want to provide a password when logging in.)

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

    If that doesn't work, try B.5.4.1. How to Reset the Root Password from the MySQL Reference Manual.