How to install phpmyadmin on NAT VPS

phpmyadmin is one of the most important packages(the others are ftp server and awstats) that are worth being installed on your VPS, even your VPS is a NAT VPS with limited resource.  Although phpmyadmin is not good to handle large database, it is pretty cool to deal with small mysql databases as it releases you from remembering the boring mysql syntax.

Installing phpmyadmin is very simple. If you have already added the EPEL repository, just issue the following command:

yum install phpmyadmin

And you are done!

You access phpmyadmin in a browser, as phpmyadmin is based on the underlying httpd service. As to NAT VPS, pay attention to the url, it should be http://externalip:someport/phpmyadmin. The port is the one your apache server is configured to listen on, not the default 80 for NAT VPS. Now visit the url in your browser, you will see the following error:


You don’t have permission to access /phpmyadmin on this server.

That is because phpmyadmin does not allow access from remote ip addresses by default. Modify the phpmyadmin config file to allow access from your PC.  The phpmyadmin config file is /etc/httpd/conf.d/phpMyAdmin.conf, which is included by the main httpd config file(/etc/httpd/conf/httpd.conf). Change the lines “Require ip″ to “Require ip yourpcip” and “Allow from″ to “Allow from yourpcip”. Now refresh, you will see the phpmyadmin login window. If you login with root and an empty password, you will get the following error even you did not set a password for root:

Login without a password is forbidden by configuration (see AllowNoPassword)

You can manage your databases without a password via the command tool mysql, for example:

mysql -u root -p

mysql> show databases;

But you must set a password for root before using phpmyadmin.

mysqladmin -u root password “somepassword”

Now login with root/password, you will be able to see the main GUI of phpmyadmin.


Posted in tips of hosting