Recommended VPS Complete list of best VPS hosting providers.

How to Install PHPMyAdmin on CentOS LAMP Server

Install and setup PHPMYADMIN MySQL software on CentOS server running Apache (LAMP) – I keep figuring what’s the next tutorials should be until then I contacted by one of my readers asking me how to install PhpMyAdmin. So here it is the tutorial to guide you how to install PhpMyAdmin on a CentOS server running LAMP stack (Linux, Apache, MySQL, PHP). However I assume by following this tutorial you have already had a server with LAMP stack installed, configured and running properly. Otherwise simply follow my previous guide how to set it up or here for installing LAMP with PHP 5.5 and MySQL v5.5.32.

What you’ll need?

  1. This guide is done in a CentOS 6.4 x86_64 VPS (as always by DigitalOcean). Hence, you’ll need a CentOS server. However you can still follow the tutorial by adjusting some commands if you are using any other Linux Distros.
  2. I also assumed you knew already how to use Putty or Terminal to SSH-ing a server.
  3. I believe you knew –at least part ofmost common Unix commands used to manage an unmanaged server.

How To Install PHPMYADMIN

Step 1 – Login to your server and follow my previous guide about Basic setup for CentOS before you build a live web server. You may and may not follow that tutorial but if you followed, it will give you some basic security tweak to your server.

Before you proceed to the next steps, it is better to explain that all commands in this tutorial are written without the “sudo” prefix. However if you disabled root login and you logged in using another username with root privilege, you can add the “sudo” prefix all by your self. Alternatively you can simply type su, hit Enter and type in your password twice to switch login as root. You may also need to type this command to go to the root directory:

cd ~

Step 2 – Install PhpMyAdmin via yum using this command:

yum install phpmyadmin -y

pic:

install phpmyadmin

p.s: Optional – You better firstly issue “yum update -y” and “yum upgrade -y” before running above command just to make sure yum is updated.

Step 3 – So the you’ve installed PhpMyAdmin but you may also firstly need to edit Apache configuration before using it. Edit phpmyadmin.conf file:

nano /etc/httpd/conf.d/phpmyadmin.conf

Step 4 – 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 you’ll need to comment (add # symbol) 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. At the end it should look like this:

setup phpmyadmin

Now save (Control+O) then exit Nano editor (Control+X).

Step 5 – This step is optional, changing how the way you login to PhpMyAdmin from “cookie”-based authentication to “http”. Edit PhpMyAdmin configuration file (config.inc.php):

nano /usr/share/phpmyadmin/config.inc.php

then look for the line that says:

$cfg['Servers'][$i]['auth_type'] = 'cookie';

now replace ‘cookie’ with ‘http’

$cfg['Servers'][$i]['auth_type'] = 'http';

screenshot:

change auth

Once done, save it then exit Nano editor.

Step 6 – Finally, restart Apache and MySQL:

service httpd restart

and

service mysqld restart

pic:

restart service

Access and Login PHPMYADMIN

You can access PhpMyAdmin in your browser via:

http://your.ip.address/phpmyadmin

or

http://yourdomain.tld/phpmyadmin

Your browser should directly prompt you to enter username and password. You can simply use root as username and enter its password. Remember, the password is the MySQL root password not your server root password. You can also use any other MySQL username and password if you have created one. Read top most common MySQL basic commands.

phpmyadmin

13 Comments

Add a Comment

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

Get more stuff like this
in your inbox

Subscribe and get interesting stuff plus faster updates to your email.