Saturday, 31 August 2019

How to Install MariaDB Database on CentOS 7



MariaDB is a popular open-source database and community-developed fork of MySQL. MariaDB database, It is widely used for database management in LAMP stack like servers.
This article describes, how to install MariaDB on CentOS 7.

Step 1. Package installation: Since MariaDB is available in CentOS 7 Base Repository, run the following command to install to install MariaDB packages:

[root@linuxcloudy ~]# yum install mariadb-server
Loaded plugins: fastestmirror
……………………..
Installed:
  mariadb-server.x86_64 1:5.5.60-1.el7_5

Dependency Installed:
  mariadb.x86_64 1:5.5.60-1.el7_5                         perl.x86_64 4:5.16.3-294.el7_6                         perl-Carp.noarch 0:1.26-244.el7
  perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7            perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7            perl-DBD-MySQL.x86_64 0:4.023-6.el7
  perl-DBI.x86_64 0:1.627-4.el7                           perl-Data-Dumper.x86_64 0:2.145-3.el7                  perl-Encode.x86_64 0:2.51-7.el7
  perl-Exporter.noarch 0:5.68-3.el7                       perl-File-Path.noarch 0:2.09-2.el7                     perl-File-Temp.noarch 0:0.23.01-3.el7
  perl-Filter.x86_64 0:1.49-3.el7                         perl-Getopt-Long.noarch 0:2.40-3.el7                   perl-HTTP-Tiny.noarch 0:0.033-3.el7
  perl-IO-Compress.noarch 0:2.061-2.el7                   perl-Net-Daemon.noarch 0:0.48-5.el7                    perl-PathTools.x86_64 0:3.40-5.el7
  perl-PlRPC.noarch 0:0.2020-14.el7                       perl-Pod-Escapes.noarch 1:1.04-294.el7_6               perl-Pod-Perldoc.noarch 0:3.20-4.el7
  perl-Pod-Simple.noarch 1:3.28-4.el7                     perl-Pod-Usage.noarch 0:1.63-3.el7                     perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
  perl-Socket.x86_64 0:2.010-4.el7                        perl-Storable.x86_64 0:2.45-3.el7                      perl-Text-ParseWords.noarch 0:3.29-4.el7
  perl-Time-HiRes.x86_64 4:1.9725-3.el7                   perl-Time-Local.noarch 0:1.2300-2.el7                  perl-constant.noarch 0:1.27-2.el7
  perl-libs.x86_64 4:5.16.3-294.el7_6                     perl-macros.x86_64 4:5.16.3-294.el7_6                  perl-parent.noarch 1:0.225-244.el7
  perl-podlators.noarch 0:2.5.1-3.el7                     perl-threads.x86_64 0:1.87-4.el7                       perl-threads-shared.x86_64 0:1.43-6.el7

Complete!
[root@linuxcloudy ~]#

Step 2. Start MariaDB service: Run the following commands to start the server and enable on startup:

[root@linuxcloudy ~]# systemctl start mariadb
[root@linuxcloudy ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@linuxcloudy ~]#

Step 3. Verify the installation: Check the service status and check MariaDB database by access its interactive interface:

[root@linuxcloudy ~]# systemctl status mariadb
mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2019-08-31 17:23:30 IST; 1min 22s ago
 Main PID: 7640 (mysqld_safe)
   CGroup: /system.slice/mariadb.service
           ├─7640 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─7802 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-fil...

Aug 31 17:23:27 linuxcloudy mariadb-prepare-db-dir[7562]: strongly recommended for production servers.
Aug 31 17:23:27 linuxcloudy mariadb-prepare-db-dir[7562]: See the MariaDB Knowledgebase at http://mariadb.com/kb or the
Aug 31 17:23:27 linuxcloudy mariadb-prepare-db-dir[7562]: MySQL manual for more instructions.
Aug 31 17:23:27 linuxcloudy mariadb-prepare-db-dir[7562]: Please report any problems at http://mariadb.org/jira
Aug 31 17:23:27 linuxcloudy mariadb-prepare-db-dir[7562]: The latest information about MariaDB is available at http://mariadb.org/.
Aug 31 17:23:27 linuxcloudy mariadb-prepare-db-dir[7562]: You can find additional information about the MySQL part at:
Aug 31 17:23:27 linuxcloudy mariadb-prepare-db-dir[7562]: http://dev.mysql.com
Aug 31 17:23:27 linuxcloudy mysqld_safe[7640]: 190831 17:23:27 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Aug 31 17:23:27 linuxcloudy mysqld_safe[7640]: 190831 17:23:27 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Aug 31 17:23:30 linuxcloudy systemd[1]: Started MariaDB database server.
[root@linuxcloudy ~]#

Run the following command to enter in MariaDB interface:

[root@linuxcloudy ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server

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

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

MariaDB [(none)]>
MariaDB [(none)]> \q
Bye
[root@linuxcloudy ~]#

Done!!! MariaDB Database is installed successfully. Use \q command to exit from the interface.

No comments:

Post a Comment