MySQL/MariaDB Error 1698 (28000): Access denied for user root@localhost



MySQL/MariaDB Error 1698 (28000): Access denied for user root@localhost

MySQL/MariaDB Error 1698 (28000): Access denied for user root@localhost

A unix_socket connection is used to access the MySQL server by default. This means that the authentication process is based on the current user who is currently logged in to the system. If you specify the user on the MySQL client using the -u option, authentication fails:

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

You must change the authentication method in the mysql database.

In my case, there was no need to restart the mysql service. The “Flush privileges” command updates the service settings. In any case, if the connection is denied after the process, you can try to restart the mysql service with the command

systemctl restart mysqld.service

Operating system: Linux
Distribution: Debian
Version: 10 or Buster

SQL Server: MariaDB
Version: 10

Comments are closed.