I've ran into a similar problem and got it working using this solution.
STEP 1: ADD UNIX AUTHENTICATION PLUGIN TO MARIADB CONFIG
Change the file
Add the line below
plugin-load-add = auth_socket.so
Restart the server and you should log using
sudo mysql -u root
It seems that Mariadb developpers have found a new approach for identifying based on the actual user, so they made an extension that allow you: if you're
user1 on Linux and there happen to be a MySQL user named
user1 then he will be logged in without a password based on the socket file (the last sentence is just my understanding
I could be wrong or imprecise).
The bottom line you're good with the first step unless want the old identification behavior then move to step2 :
STEP 2: CHANGE TO STANDARD AUTHENTICATION
Run the following commands
update user set plugin='' where User='root';
Source and more info