By default MariaDB use the unix_socket
plugin to authenticate users.
But it's easier to use mysql_native_password
for dev (and only for dev because it's way less secure).
Get root access
sudo su
Connect to mysql
mysql
Run this query
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;
SET PASSWORD = PASSWORD('foo');
And then
flush privileges;
Enjoy !
This no longer works in modern version of MariaDB 10.4.3+. Use this query instead.
You can also find more information at https://mariadb.com/kb/en/authentication-plugin-unix-socket/.