Install and Configure MariaDB Server with phpMyAdmin on CentOS/RHEL 7.x

Install Packages:

[root@localhost ~]# yum install mariadb-server mariadb-client
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile


Dependencies Resolved

================================================================================
 Package                     Arch       Version               Repository   Size
================================================================================
Installing:
 mariadb-server              x86_64     1:5.5.47-1.el7_2      updates      11 M
Installing for dependencies:
 libaio                      x86_64     0.3.109-13.el7        base         24 k
 mariadb                     x86_64     1:5.5.47-1.el7_2      updates     8.9 M
 perl-Compress-Raw-Bzip2     x86_64     2.061-3.el7           base         32 k
 perl-Compress-Raw-Zlib      x86_64     1:2.061-4.el7         base         57 k
 perl-DBD-MySQL              x86_64     4.023-5.el7           base        140 k
 perl-DBI                    x86_64     1.627-4.el7           base        802 k
 perl-IO-Compress            noarch     2.061-2.el7           base        260 k
 perl-Net-Daemon             noarch     0.48-5.el7            base         51 k
 perl-PlRPC                  noarch     0.2020-14.el7         base         36 k
Updating for dependencies:
 mariadb-libs                x86_64     1:5.5.47-1.el7_2      updates     755 k

Transaction Summary
================================================================================
Install  1 Package  (+9 Dependent packages)
Upgrade             ( 1 Dependent package)

Total download size: 22 M
Is this ok [y/d/N]: y 
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/11): libaio-0.3.109-13.el7.x86_64.rpm                   |  24 kB   00:00     
(2/11): mariadb-libs-5.5.47-1.el7_2.x86_64.rpm             | 755 kB   00:01     
(3/11): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm     |  32 kB   00:00     
(4/11): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm      |  57 kB   00:15     
(5/11): perl-DBI-1.627-4.el7.x86_64.rpm                    | 802 kB   00:16     
(6/11): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm              | 140 kB   00:16     
(7/11): perl-IO-Compress-2.061-2.el7.noarch.rpm            | 260 kB   00:01     
(8/11): perl-Net-Daemon-0.48-5.el7.noarch.rpm              |  51 kB   00:00     
(9/11): perl-PlRPC-0.2020-14.el7.noarch.rpm                |  36 kB   00:00     
(10/11): mariadb-5.5.47-1.el7_2.x86_64.rpm                 | 8.9 MB   00:23     
(11/11): mariadb-server-5.5.47-1.el7_2.x86_64.rpm          |  11 MB   00:24     
--------------------------------------------------------------------------------
Total                                             840 kB/s |  22 MB   00:26     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 1:mariadb-libs-5.5.47-1.el7_2.x86_64                        1/12 
  Installing : 1:mariadb-5.5.47-1.el7_2.x86_64                             2/12 
  Installing : libaio-0.3.109-13.el7.x86_64                                3/12 
  Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                  4/12 
  Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                 5/12 
  Installing : perl-IO-Compress-2.061-2.el7.noarch                         6/12 
  Installing : perl-Net-Daemon-0.48-5.el7.noarch                           7/12 
  Installing : perl-PlRPC-0.2020-14.el7.noarch                             8/12 
  Installing : perl-DBI-1.627-4.el7.x86_64                                 9/12 
  Installing : perl-DBD-MySQL-4.023-5.el7.x86_64                          10/12 
  Installing : 1:mariadb-server-5.5.47-1.el7_2.x86_64                     11/12 
  Cleanup    : 1:mariadb-libs-5.5.35-3.el7.x86_64                         12/12 
  Verifying  : perl-DBD-MySQL-4.023-5.el7.x86_64                           1/12 
  Verifying  : perl-Net-Daemon-0.48-5.el7.noarch                           2/12 
  Verifying  : perl-PlRPC-0.2020-14.el7.noarch                             3/12 
  Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                 4/12 
  Verifying  : 1:mariadb-libs-5.5.47-1.el7_2.x86_64                        5/12 
  Verifying  : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                  6/12 
  Verifying  : 1:mariadb-server-5.5.47-1.el7_2.x86_64                      7/12 
  Verifying  : libaio-0.3.109-13.el7.x86_64                                8/12 
  Verifying  : perl-DBI-1.627-4.el7.x86_64                                 9/12 
  Verifying  : perl-IO-Compress-2.061-2.el7.noarch                        10/12 
  Verifying  : 1:mariadb-5.5.47-1.el7_2.x86_64                            11/12 
  Verifying  : 1:mariadb-libs-5.5.35-3.el7.x86_64                         12/12 

Installed:
  mariadb-server.x86_64 1:5.5.47-1.el7_2                                        

Dependency Installed:
  libaio.x86_64 0:0.3.109-13.el7                                                
  mariadb.x86_64 1:5.5.47-1.el7_2                                               
  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-5.el7                                           
  perl-DBI.x86_64 0:1.627-4.el7                                                 
  perl-IO-Compress.noarch 0:2.061-2.el7                                         
  perl-Net-Daemon.noarch 0:0.48-5.el7                                           
  perl-PlRPC.noarch 0:0.2020-14.el7                                             

Dependency Updated:
  mariadb-libs.x86_64 1:5.5.47-1.el7_2                                          

Complete!

Start mariabd service

service mariadb start

or

systemctl start  mariadb.servic

If service started successfully try login mariadb console:

[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.47-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)]> quit
Bye

Currently your server running completely unsecured. To protect your server with password and other parameter run mysql_secure_installation command and follow bellow tasks:

[root@localhost ~]# 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.

Set root password? [Y/n] y
New password: <Type your root password here>
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Now try login with user and password:

[root@localhost ~]# mysql -u root -p
Enter password:  < Enter your password here
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 5.5.47-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)]> 

Install phpMyAdmin:

Phpmyadmin is an opensource tool to manage MySQL database using web browser. it can perform almost all tasks such as creating,deleting,modifying databases,users,tables and fields .

Step 1: Add the EPEL Repository

phpMyAdmin is part of Extra Packages for Enterprise Linux (EPEL), which is a community repository of non-standard packages for the RHEL distribution. First, we’ll install the EPEL repository:

rpm -iUvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
warning: /var/tmp/rpm-tmp.tAUL8z: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-7-7                 ################################# [100%]

Step 2: Update repositories.

yum check-update

Step 3: Now install phpMyAdmin package along with dependencies.

yum -y install phpmyadmin

Step 4: Basic Configuration for phpMyAdmin

Open /etc/httpd/conf.d/phpMyAdmin.conf file ( Apache config file for phpmyadmin ) and edit as follows.

Find these lines . ( Found 2 times )

 # Apache 2.4
  Require ip 127.0.0.1
  Require ip ::1
     

Replace with

 # Apache 2.4
    # Require ip 127.0.0.1
    # Require ip ::1
    Require all granted

Step 5: Restart Apache service .

systemctl restart httpd.service

Now open http://serverIP/phpmyadmin in your browser. You can login using root as username and mysql root password.