How to install MariaDB On CentOS 7.

What is MariaDB?

MariaDB is a drop-in replacement for MySQL. it offers the speed and performance optimizations over MySQL. It is easy to install and migrate from MySQL server. It is compatible with MySQL.

Compatible list of MariaDB and MySQL.

  • MariaDB 5.1 -> MySQL 5.1
  • MariaDB 5.2 -> MySQL 5.3
  • MariaDB 5.5 -> MySQL 5.5

More details about these compatibilities can be found at: MariaDB versus MySQL – Compatibility.

MariaDB offers more storage engines than MySQL, including Cassandra storage engine (NoSQL, in MariaDB Version 10), XtraDB (a performance enhanced fork of the InnoDB storage engine), and OQGRAPH (in MariaDB Version 10).

This tutorial will show you how to install MariaDB on CentOS 7.

1) Install MariaDB

# yum install -y mariadb-server  mariadb

2) Verify the Installed packages

# rpm -qa | grep mariadb

mariadb-server-5.5.44-1.el7_1.x86_64

mariadb-5.5.44-1.el7_1.x86_64

mariadb-libs-5.5.44-1.el7_1.x86_64

3) Enable mariadb.

# systemctl enable mariadb

4) Start mariadb.

# systemctl start mariadb

5 ) Check mariadb’s status.

# systemctl status mariadb

mariadb.service – MariaDB database server

Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)

Active: active (running) since Mon 2015-08-31 23:01:28 EDT; 40s ago

Process: 14945 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)

Process: 14865 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)

6) Execute some basic setups.

# /usr/bin/mysql_secure_installation

/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we’ll need the current

password for the root user.  If you’ve just installed MariaDB, and

you haven’t set the root password yet, the password will be blank,

so you should just press enter here.

 

Enter current password for root (enter for none):

OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB

root user without the proper authorisation.

You already have a root password set, so you can safely answer ‘n’.

 

Change the root password? [Y/n] y

New password: your-password

Re-enter new password:  your-password

Password updated successfully!

Reloading privilege tables..

… Success!

7) Access mariadb using command line.

# mysql -uroot -pyour-password

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 7

Server version: 5.5.44-MariaDB MariaDB Server

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

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

 

MariaDB [(none)]>

8) Show existing databases.

MariaDB [(none)]> show databases;

+——————–+

| Database           |

+——————–+

| information_schema |

| mysql              |

| performance_schema |

+——————–+

3 rows in set (0.00 sec)

9) Exit mariadb connection.

MariaDB [(none)]> exit

Bye

10 ) Configure the firewall to allow different server connect to mariadb.

# firewall-cmd –permanent –add-service=mysql

Success

# firewall-cmd –reload

Success

# firewall-cmd –list-services

dhcpv6-client mysql ssh

11) Now you finish MariaDB installation successfully. Enjoy !

Be the first to comment

Leave a Reply