Cannot login to MariaDB server with root account

Problem

You are trying to login to MariaDB with the root user, but even after resetting the password, it is still not possible to login.

Solution

It seems that certain MariaDB packages that come with Linux distributions use the unix_socket as the authentication method.

MariaDB [mysql]> SELECT user, host, plugin FROM user WHERE user='root';
+------+-----------+-------------+
| user | host      | plugin      |
+------+-----------+-------------+
| root | localhost | unix_socket |
+------+-----------+-------------+
1 row in set (0.00 sec)

Change the plugin as described here (https://stackoverflow.com/a/43424234) with the following:

MariaDB [mysql]> UPDATE mysql.user SET plugin = '' WHERE user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0