MySQL access denied

MySQL

I am trying to install MySQL, but it says access denied. Does anyone know what to do? I'm doing this on a macbook.

  mysql> \q
    Bye
    Stefans-Air:bin stefansudu$ ./mysqladmin -u root password 'root'
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: NO)'

Best Answer

It is an authentication error. You can debug this issue by following the below steps:

  • First check the host name. Are you mentioned the correct hostname?
  • Check MySQL running on the mentioned host. If not running, start the service and trying to connect.
  • If MySQL service is running and still, if you are not able to connect, check whether you are giving the right password.
  • If password is right, check whether the user have access from the mentioned host. If not, please grant access to that user.
  • If you forget the password, please try to reset the password. Click here for reference.
  • Still, if you are getting the same error, Click here to see other possible workarounds.

I hope this answer will help you.