Ubuntu

How to install MariaDB on Ubuntu 18.10

MariaDB is a community-developed fork of MySQL. MariaDB is a free and open source database software, widely used ranging from websites to banking software. It is an improved, drop-in replacement for MySQL. It is one of the most popular database servers in the world, developed after the acquisition of MySQL by Oracle Inc. to stay free and open source.
In this tutorial, we will show you how to install latest stable MariaDB 10.3 version on Ubuntu 18.10 server.

Installing MariaDB Database Server On Ubuntu 18.10

At the time of writing this article, the latest version of MariaDB available from the official MariaDB repositories is MariaDB version 10.3. Before continuing with the next step you should visit the MariaDB Repository page and check if there is a new version available.
To install MariaDB 10.3 on your Ubuntu 18.04 server perform the following steps.
Add the MariaDB GPG key to your system using the following command:

$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

Once the key is imported, add the MariaDB repository with:

$ sudo add-apt-repository 'deb [arch=amd64] http://mariadb.petarmaric.com/repo/10.3/ubuntu cosmic main'
Add MariaDB repository on Ubuntu server 18.10
Add MariaDB repository on Ubuntu server 18.10

Once the key is imported and the repository added you can install MariaDB 10.3 from the MariaDB repository with:

$ sudo apt update
$ sudo apt install mariadb-server

You will be prompted to provide MariaDB root password.

Configuring MariaDB server
Configuring MariaDB server – set database root password
Repeat password:

Configure MariaDB server
Configure MariaDB server

Press <Ok> to confirm the new password and install MariaDB. Make sure you note provided password.
The MariaDB service will start automatically, to verify it type:

$ sudo systemctl status mariadb.service
Status MariaDB service
Status MariaDB service
Then connect to MariaDB shell by running below command. You need to enter password configured in above step.

$  mysql -u root -p

Example output:

Connect to MariaDB
Connect to MariaDB
Check version using the command:
Check version
Check version

Manage MariaDB Service

Sometimes you need to stop or start MariaDB service. Use the following commands to stop, start, check status and restart MariaDB service.

$ sudo systemctl stop mariadb.service      # To Stop MariaDB service 
$ sudo systemctl start mariadb.service     # To Start MariaDB service 
$ sudo systemctl status mariadb.service    # To Check MariaDB service status 
$ sudo systemctl restart mariadb.service   # To Stop then Start MariaDB service

Conclusion

Now that your MariaDB server is up and running and you know how to connect to the MariaDB server from the command line. Thanks for reading this article and please drop your suggestion on the comment section.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close
Close