Speaktech.in

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

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


$ sudo mysql -u root # I had touse"sudo" since is new installationmysql>USE mysql;mysql>SELECTUser, Host, plugin FROM mysql.user;+------------------+-----------------------+|User| plugin                |+------------------+-----------------------+| root             | auth_socket           || mysql.sys        | mysql_native_password || debian-sys-maint | mysql_native_password |+------------------+-----------------------+

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

There are 2 ways to solve this:

  1. You can set the root user to use the mysql_native_password plugin
  2. You can create a new db_user with you system_user (recommended)

Option 1:

$ sudo mysql -u root # I had touse"sudo" since is new installationmysql>USE mysql;mysql>UPDATEuserSET plugin='mysql_native_password'WHEREUser='root';mysql> FLUSH PRIVILEGES;mysql>exit;$ service mysql restart