MySQL login after secure installation I have installed mysql5.5 via secure installation procedure by using:

sudo mysql_secure_installation


Now when I am trying to login in MySQL from the terminal by using:

sudo -u root -p


The following error is displayed: 


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


I have also used:

sudo -u root


Which I got the following error:


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


What should I do for this error?
You most likely have a .my.cnf file in your home directory, which is specifying a password.

The clue here is that when you did not specify a password (sudo -u root), the error message is still saying that you did.