How to Install MariaDB 10.3 on Linux Mint 19

7204
Share:
how-to-install-mariadb-10-3-on-linux-mint-19

Linux Mint 19 actually comes with MariaDB, but the default version on upstream repositories are still using version 10.1. How if we want to use the latest version (10.3 at the time of this writing)?

Dump Databases

If you already have some databases on your existing MySQL/MariaDB installation, please back them up first. Here's my post explaining how to backup MySQL databases, but if you're in a hurry, the command to backup all databases is:

$ mysqldump --opt -u [uname] -p[pass] --all-databases > [backupfile.sql]

This process could take some time depends on the size of your existing databases.

Remove Existing Mysql/MariaDB Installation

To remove existing MySQL/MariaDB installation, type this command:

$ sudo apt remove mariadb-server

if you have MariaDB. If you're using MySQL server, use this command:

$ sudo apt remove mysql-server (if you have MySQL)

After pressing "Enter" and prompted for password, you should see something like this:

Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  galera-3 mariadb-server-10.1 mariadb-server-core-10.1 socat
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  mariadb-server
0 upgraded, 0 newly installed, 1 to remove and 199 not upgraded.
After this operation, 65,5 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 372371 files and directories currently installed.)
Removing mariadb-server (1:10.1.38-0ubuntu0.18.04.1) ...

Now we're ready to continue with installation.

MariaDB 10.3 Installation

Install software-properties-common

To install MariaDB on Linux Mint 19, first we need to install software-properties-common as dependency.

$ sudo apt install software-properties-common
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  galera-3 mariadb-server-10.1 mariadb-server-core-10.1 socat
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  software-properties-common
0 upgraded, 1 newly installed, 0 to remove and 202 not upgraded.
Need to get 7.388 B of archives.
After this operation, 14,3 kB of additional disk space will be used.
Get:1 http://kartolo.sby.datautama.net.id/linuxmint tessa/upstream amd64 software-properties-common all 1.8.4 [7.388 B]
Fetched 7.388 B in 0s (70,5 kB/s)                    
Selecting previously unselected package software-properties-common.
(Reading database ... 372369 files and directories currently installed.)
Preparing to unpack .../software-properties-common_1.8.4_all.deb ...
Unpacking software-properties-common (1.8.4) ...
Setting up software-properties-common (1.8.4) ...

Import MariaDB Repository gpg Key

After software-properties-common installed, we need to import MariaDB repository gpg key.

$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
Executing: /tmp/apt-key-gpghome.Uy26b4Tjvj/gpg.1.sh --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
gpg: key F1656F24C74CD1D8: 6 signatures not checked due to missing keys
gpg: key F1656F24C74CD1D8: public key "MariaDB Signing Key <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Add apt Repository

To do this, create a file called mariadb.list on your /etc/apt/sources.list.d directory

$ cd /etc/apt/sources.list.d/
$ sudo vi mariadb.list

And write these lines to that file:

deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main
deb-src http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main

Save the file and quit.

Update Package Information and Install

Finally, let's update package information from all configured sources.

$ sudo apt update

Then install MariaDB 10.3

$ sudo apt install mariadb-server
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libconfig-inifiles-perl libjemalloc1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server-10.3 mariadb-server-core-10.3
Suggested packages:
  mailx mariadb-test tinyca
Recommended packages:
  libdbd-mysql-perl libterm-readkey-perl libhtml-template-perl
The following packages will be REMOVED:
  mariadb-client-10.1 mariadb-client-core-10.1 mariadb-server-10.1 mariadb-server-core-10.1
The following NEW packages will be installed:
  mariadb-client-10.3 mariadb-client-core-10.3 mariadb-server mariadb-server-10.3 mariadb-server-core-10.3
The following packages will be upgraded:
  mariadb-common
1 upgraded, 5 newly installed, 4 to remove and 204 not upgraded.
Need to get 12,0 MB of archives.
After this operation, 33,6 MB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main amd64 mariadb-common all 1:10.3.15+maria~bionic [3.496 B]
Get:2 http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main amd64 mariadb-client-core-10.3 amd64 1:10.3.15+maria~bionic [760 kB]
Get:3 http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main amd64 mariadb-client-10.3 amd64 1:10.3.15+maria~bionic [1.136 kB]
Get:4 http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main amd64 mariadb-server-core-10.3 amd64 1:10.3.15+maria~bionic [5.779 kB]
Get:5 http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main amd64 mariadb-server-10.3 amd64 1:10.3.15+maria~bionic [4.312 kB]
Get:6 http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic/main amd64 mariadb-server all 1:10.3.15+maria~bionic [3.152 B] 
Fetched 12,0 MB in 12s (979 kB/s)                                                                                                         
Preconfiguring packages ...
(Reading database ... 372371 files and directories currently installed.)
Removing mariadb-server-10.1 (1:10.1.38-0ubuntu0.18.04.1) ...
Removing mariadb-client-10.1 (1:10.1.38-0ubuntu0.18.04.1) ...
Removing mariadb-client-core-10.1 (1:10.1.38-0ubuntu0.18.04.1) ...
Removing mariadb-server-core-10.1 (1:10.1.38-0ubuntu0.18.04.1) ...
(Reading database ... 372108 files and directories currently installed.)
Preparing to unpack .../mariadb-common_1%3a10.3.15+maria~bionic_all.deb ...
Unpacking mariadb-common (1:10.3.15+maria~bionic) over (1:10.1.38-0ubuntu0.18.04.1) ...
Selecting previously unselected package mariadb-client-core-10.3.
Preparing to unpack .../mariadb-client-core-10.3_1%3a10.3.15+maria~bionic_amd64.deb ...
Unpacking mariadb-client-core-10.3 (1:10.3.15+maria~bionic) ...
Selecting previously unselected package mariadb-client-10.3.
Preparing to unpack .../mariadb-client-10.3_1%3a10.3.15+maria~bionic_amd64.deb ...
Unpacking mariadb-client-10.3 (1:10.3.15+maria~bionic) ...
Selecting previously unselected package mariadb-server-core-10.3.
Preparing to unpack .../mariadb-server-core-10.3_1%3a10.3.15+maria~bionic_amd64.deb ...
Unpacking mariadb-server-core-10.3 (1:10.3.15+maria~bionic) ...
Setting up mariadb-common (1:10.3.15+maria~bionic) ...
Installing new version of config file /etc/mysql/mariadb.cnf ...
Selecting previously unselected package mariadb-server-10.3.
(Reading database ... 372239 files and directories currently installed.)
Preparing to unpack .../mariadb-server-10.3_1%3a10.3.15+maria~bionic_amd64.deb ...
/var/lib/mysql: found previous version 10.1
Unpacking mariadb-server-10.3 (1:10.3.15+maria~bionic) ...
Selecting previously unselected package mariadb-server.
Preparing to unpack .../mariadb-server_1%3a10.3.15+maria~bionic_all.deb ...
Unpacking mariadb-server (1:10.3.15+maria~bionic) ...
Processing triggers for ureadahead (0.100.0-20) ...
ureadahead will be reprofiled on next reboot
Setting up mariadb-server-core-10.3 (1:10.3.15+maria~bionic) ...
Setting up mariadb-client-core-10.3 (1:10.3.15+maria~bionic) ...
Setting up mariadb-client-10.3 (1:10.3.15+maria~bionic) ...
Processing triggers for systemd (237-3ubuntu10.13) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up mariadb-server-10.3 (1:10.3.15+maria~bionic) ...
Installing new version of config file /etc/apparmor.d/usr.sbin.mysqld ...
Installing new version of config file /etc/default/mysql ...
Installing new version of config file /etc/init.d/mysql ...
Installing new version of config file /etc/logrotate.d/mysql-server ...
Installing new version of config file /etc/mysql/debian-start ...
2019-05-19 23:30:26 0 [Note] /usr/sbin/mysqld (mysqld 10.3.15-MariaDB-1:10.3.15+maria~bionic) starting as process 8084 ...
Setting up mariadb-server (1:10.3.15+maria~bionic)
Processing triggers for systemd (237-3ubuntu10.13) ...
Processing triggers for ureadahead (0.100.0-20) ...

MariaDB 10.3 Installation - Root Password Prompt

You will be prompted to provide MariaDB root password in the process. Just enter your desired password and then type it again. When finished, congratulation, you have successfully installed MariaDB 10.3 on your system.

Verify Installation

Let's verify that we've correctly installed MariaDB 10.3. At your shell, type:

$ mysql --version

You should see something like this:

mysql  Ver 15.1 Distrib 10.3.15-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Restore Databases

Although in most cases you should still see your existing database after upgrade to MariaDB 10.3, it's still possible that your databases wiped out. No worries, if you followed this guide exactly as it is, you should already have database backup. To restore your database using this command:

$ mysql -u [uname] -p[pass] < [backupfile.sql]

Final Words

I hope that you now know how to install MariaDB 10.3 on Linux Mint 19. If you run into any issues or have any feedback feel free to drop a comment below.

Tags
Share:

1 comment

Leave a reply

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