Bootstrap FreeKB - mySQL / MariaDB - Install MariaDB on Linux
mySQL / MariaDB - Install MariaDB on Linux

Updated:   |  mySQL / MariaDB articles

Use apt-get or yum to install MariaDB.

apt-get install mariadb mariadb-server
yum install mariadb mariadb-server


The ps command can be used to determine if your system is using init or systemd. If PID 1 is init, then you will use the service command. If PID 1 is systemd, then you will use the systemctl command.

If your system is using systemd, use the systemctl command to start and enable mariadb.

systemctl enable mariadb
systemctl start mariadb
systemctl status mariadb


If your system is using init, use the chkconfig and service commands to start and enable mariadb.

chkconfig mariadb on
service mariadb start
service mariadb status


Secure MariaDB.  There will be a series of prompts.  Create a password, remove the test database, do not allow remote connections.



When prompted to enter root password, do not enter root password, and press enter. 

Enter current password for root (enter for none):


When prompted to set root password, type Y and press enter. Type a new password. The password does not need to be the same a root system password.

Set root password? [Y/n]
New password:
Re-enter new password:


When prompted to remove the anonymous user, type Y and press enter.

Remove anonymous user? [Y/n]


When prompted to disable remote root login, type Y and press enter.

Disallow root login remotely? [Y/n]


When prompted to remove the test database, type Y and press enter.

Remove test database and access to it? [Y/n]


When prompted to reload the priviledge tables, type Y and press enter.

Reload priviledge tables now? [Y/n]


Type mysql -u root -p and press enter to connect to MariaDB. Type the password entered during the mysql_secure_installation.

mysql -u root -p
. . .
Enter password:


Type show databases; and press enter to view the databases.

MariaDB [(none)]> show databases;
| Database           |
| information_schema |
| mysql              |
| performance_schema |
3 rows in set (0.00 sec)


Type quit to disconnect from MariaDB.

MariaDB [(none)]> quit


Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee


Add a Comment

Please enter 03fda3 in the box below so that we can be sure you are a human.