I would like to connect to mysql as user but it gives me Access denied, I actually have to use sudo to log into the db. How can I change this so that even a user has permissions to login to mysql as root?

$ mysql -u root
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
$ sudo mysql -u root
//this works
  • 1
    Mysql login is linked to the user account via unix socket. Use a password to login to root user, and/or create a database user matching your local user. – pLumo Nov 26 '20 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.