phpMyAdmin is a free, php and web browser based, open source, administration tool for MySQL. If your web application or website requires MySQL database, it is recommended that you install phpMyAdmin for easier database management.
-
This documentation assumes you've already installed the LAMP stack on your VPS. If you haven't done that yet, refer to the LAMP installation guide.
-
Ensure that you are connected to the server using an SSH client as a root user.
-
You need not follow this documentation, in case you have installed cPanel or Plesk. phpMyAdmin comes pre-installed with these panels.
To Setup MySQL
Check whether the MySQL service is already running by using the command:
service mysqld status
If the service is currently not running, you can start it using the command:
service mysqld start
To Setup MySQL User
Set the MySQL Server's root password.
-
This is the root user for MySQL Server, and is different from the VPS container's root user.
-
Since this is the first login, the service will not require any password to connect as root.
Use the command:
mysqladmin -u root password <your_new_password>
To Install phpMyAdmin
-
Before you install phpMyAdmin using yum, you will have to install EPEL or RPMForge repository. This is because phpMyAdmin is not included by default in CentOS repository. In this example, EPEL is used.
Execute the following commands:
cd /tmp
wget http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
-
Proceed with the yum installation of phpMyAdmin using the command:
yum -y install phpmyadmin
To Configure phpMyAdmin
phpMyAdmin can be accessed only from localhost, by default. To access it from your local system, you will have to change the configuration settings. Edit the file phpMyAdmin.conf, which can be found under /etc/httpd/conf.d.
vi /etc/httpd/conf.d/phpMyAdmin.conf
Edit the file as below:
-
Comment the Deny directive,
AND
-
mention your IP Address for Allow from.
You may customize the access settings as per hostname, IP Address and IP Address range depending on your needs. It is recommeded that you limit its access for security reasons.
To Restart Apache and Start Using phpMyAdmin
Restart the httpd service using the command:
service httpd restart
Now, you can access http://<Your_IP_Address>/phpMyAdmin or http://<Your_Domain_Name>/phpMyAdmin.
You can customize the settings further as deemed necessary.