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).
If you want to use e.g. phpMyAdmin and need plain authentication, you can deactivate this behavior:
- log in to your database server using sudo mysql -u root -p
- switch to the system database: use mysql;
- deactivate the plugin: UPDATE user SET plugin='' WHERE user='root';
- set a password for the database server root account UPDATE user SET password=PASSWORD('NEWPASSWORD') WHERE user='root';
- clear the cache: flush privileges;
The plain authentication (username/password) should work from now on.