Skip to content

Setting up MariaDB on Linux Mint 19.3

If you’ve been following along my blog and my posts over the past year or so, you’ll know that I bought a new laptop last summer and installed Linux Mint 19.2 on it. In December 2019, I upgraded this to Linux Mint 19.3, which was done very quickly. One thing I had been meaning to do is to set it up as a development platform, but I haven’t been motivated had a chance to do so until the past few days.

Linux Mint, I think, uses MariaDB instead of MySQL by default, which suits me fine, but I was having problems trying to get it setup on my laptop (and my desktop PC, which also uses Linux Mint 19.3). This is pretty common for me. I don’t install and setup MariaDB/MySQL often enough to remember the intricacies of what works and what doesn’t. Due to that, I normally find the instructions online.

When starting to setup MariaDB a few days ago, I used these instructions, but as soon as I tried to login, I got an error that said access denied for ‘root’@’localhost’. This happened on the command line and when I tried using Adminer. It’s really annoying when that happens, especially when the software is freshly installed and shouldn’t have any problems.

I went to DuckDuckGo and entered mariadb access denied for root@localhost and this article was one of the first links it provided. The solution that worked for me was the second one down. It goes a bit like this:

user@localhost:~$ sudo mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 30
Server version: 10.1.43-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> update user set plugin='' where User='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> exit
user@localhost:~$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 31
Server version: 10.1.43-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04

This was the solution that worked for me. After that, I was able to login to MariaDB at the command line and with Adminer.

I’m putting this here in case others have similar problems…and so I can quickly sort out my desktop PC in the next day or two.

Published inHow-To

Be First to Comment

Leave a Reply

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