How to Install MariaDB on Ubuntu 18.04
Today, We will discuss how to install MariaDB on Ubuntu 18.04. The MariaDB is a database server and it’s an open-source relational database management system, so you can download and use it as much as you want free of charge. There are two ways to install MariaDB. (1) Install from MariaDB mirror and (2) Install from repository
(1) Install from MariaDB mirror
First, find the MariaDB repository file from the official website. after then import the package key and added the repository package on your system.
Ubuntu 18.04 LTS “bionic”
1 2 3 | sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.edatel.net.co/mariadb/repo/10.4/ubuntu bionic main' |
Ubuntu 16.04 LTS “xenial”
1 2 3 | sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] http://mirror.edatel.net.co/mariadb/repo/10.4/ubuntu xenial main' |
Install from repository
The MariaDB Installing from the Ubuntu default repository is a straightforward way. but you if you want to use below the following command then will be installed the old version of MariaDB.
1 2 | sudo apt-get update sudo apt-get install mariadb-server mariadb-client |
During installation, we will ask you root user password and confirmation password.
Mysql Secure Installation
1 | sudo mysql_secure_installation |
Above command run in the command prompt, it will ask you following configuration.
1 2 3 4 5 | set root password (if not set in the configuration step above). disable remote root login remove test database remove anonymous users and reload privileges |
After complete installation, we will check a MariaDB connection using the below command.
1 | mysql -u root -p |
If you want to know the server status or you want to start or stop server then you can do using the below command.
1 2 3 | sudo systemctl start mariadb sudo systemctl enable mariadb sudo systemctl status mariadb |