None
Datenbanken

[EN] Solved: Error 1698 (28000) in MySQL/MariaDB

by Viktor Garske on Feb. 5, 2017, midnight
Language icon Language: this article is available in: de

Last year I installed the database server MariaDB on a Ubuntu Server 16.04 LTS using the command

sudo apt install mariadb-server

The installation was successful but the installer didn't ask me for any root password. Every login attempt failed and this error appeared:

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

The solution is quite easy and already explained here. In a nutshell: MariaDB on Ubuntu Server 16.04 uses the plugin "unix_socket" for authentication. You have to authenticate using your Unix account (in other words: call the MySQL client using sudo).

Attention: the use of the following commands is at your own risk! Every computer system is different. I'm not responsible for any damage! I tested the commands on my system but I don't know your system and dependency constellation. Please contact your system administrator for further information.

If you want to use e.g. phpMyAdmin and need plain authentication, you can deactivate this behavior:

  1. log in to your database server using sudo mysql -u root -p
  2. switch to the system database: use mysql;
  3. deactivate the plugin: UPDATE user SET plugin='' WHERE user='root';
  4. set a password for the database server root account UPDATE user SET password=PASSWORD('NEWPASSWORD') WHERE user='root';
  5. clear the cache: flush privileges;

The plain authentication (username/password) should work from now on.

 

Author image
Viktor Garske

Viktor Garske ist der Hauptautor des Blogs und schreibt gerne über Technologie, Panorama sowie Tipps & Tricks.

Comments (0)

Comments are not enabled for this entry.