ERROR 1698 (28000): Access denied for user ‘root’@’localhost’

When you try to login to the MySQL database with the root user, you get the “ERROR 1698 (28000): Access denied for user ‘root’@’localhost'” error.

Some systems like Ubuntu, mysql is using by default the UNIX auth_socket plugin.

Connect to your database and run commands


As you can see in the output, the root user is using the auth_socket plugin

There are 2 ways to solve this:

First option:

Second option (recommended):


Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.
Harinder Singh

Harinder Singh

My name is Harinder Singh and I specialize in Software industry. I consider myself as a life learner. I love learning new concepts, embracing new ideas and reading and searching for innovation.