MariaDB / MySQL – Access denied for user ‘root’@’localhost’

I am using MariaDB for one of the project and today I encountered some weird issue while connecting from command line. For those who are not familiar with MariaDB – it is basically open source version of MySQL. Click here to get more information about MariaDB. Also, click here to read various MariaDB articles, basic commands, etc. You can access various training tutorials here.

Alright, so I was trying to login to MariaDB from my Ubuntu Command Prompt but I was constantly getting error: Access denied for user ‘root’@’localhost’

I was going in various directions, but the solution to this problem was very very simple. I just had to run the login command with sudo, can you believe it? If prompted, you will have to type sudo password.

Just so you know, default password for MariaDB root user is <nopassword>, that’s right, it does not have any password.

Leave a Reply

Your email address will not be published. Required fields are marked *