How to configure phpmyadmin in Linux server

phpMyAdmin is a free and open source tool written in PHP intended to handle the administration of MySQL or MariaDB with the use of a web browser. It can perform various tasks such as creating, modifying or deleting databases, tables, fields or rows; executing SQL statements; or managing users and permissions.

This article explains the steps to install phpMyAdmin in Linux server.

Step1: Login to your server via SSH.

Step2: Install PhpMyAdmin via yum.

# yum install phpmyadmin -y

Step3: Edit phpmyadmin configuration file.

# vi /etc/httpd/conf.d/phpMyAdmin.conf

Step4: Its main content will look like this.

# Web application to manage MySQL
#

<Directory "/usr/share/phpmyadmin">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>

Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

Now comment out the lines starting from <Directory “/usr/share/phpmyadmin”> till the </Directory> line. This is aimed to change the Apache configuration so that phpMyAdmin allows connections not just from localhost. Then save the configuration file.

Step5: Edit PhpMyAdmin configuration file.

vi /etc/phpMyAdmin/config.inc.php

then look for the line,
$cfg['Servers'][$i]['auth_type'] = 'cookie';

now replace ‘cookie’ with ‘http’
$cfg['Servers'][$i]['auth_type'] = 'http';

Once done, save it and close the file

Step6: Restart Apache and MySQL:

service httpd restart

and

service mysqld restart

You can access PhpMyAdmin in your browser now.

http://ip.address/phpmyadmin

or

http://domain.tld/phpmyadmin

Leave a Reply

Your email address will not be published. Required fields are marked *