Admin MySQL through a web browser with phpMyAdmin

Q We have a web hosting account that provides PHP and MySQL with an Apache server. We have FTP access for uploading files but no shell account, which makes setting up SQL databases and the like rather tricky. We are not able to install any extra software on this server. We could move to somewhere with shell access, but the accountant likes the price we pay here. Is there a way of gaining administrative access through a web browser to do what we need?

A While changing to a host that allows SSH access would give more flexibility, there are solutions that remain attractive even if you cannot get a command prompt. Foremost is phpMyAdmin (www.phpmyadmin.net). As you have probably guessed from the name, this is a MySQL administration program written in PHP; it only need to be installed as a set of files in your web space, after suitable securing and configuration. Most web hosts only allow access to the database from local IPs, so the scripts must be running on the web host, not your own machine.

Download and unpack one of the tarballs from the phpMyAdmin website (they differ only in the languages included and archiving method used). The traditional way of setting up phpMyAdmin was to create a suitable config.inc.php file, using the included sample as a basis, but there is now a setup script that you can run once you have copied the files to your web server. Before you do, make sure this is secure. Anyone with access to your server's phpMyAdmin directory can read or change any of your databases, so secure it with a .htaccess file (or other means) so that only passworded accounts can connect.

If possible, include it in a section of your web space that is accessible via HTTPS, as you will be transferring passwords when you run the setup script. Create a config directory in the phpmyadmin directory and copy the whole phpmyadmin directory to your web space (including the .htaccess file). Go to https://www.your.webspace/phpmyadmindir/setup.php and fill out the boxes with your MySQL login details. Now you can go to https://www.your.webspace/phpmyadmindir/ and see a list of your databases. Select one and you'll see the tables in it. From here you can browse, query and modify your SQL tables to your heart's content.

If you use PostgreSQL instead of MySQL, there is an equivalent program called phpPgAdm, available from http://phppgadmin.sourceforge.net. SQL databases are not all you can administer via a web interface. Webmin lets you change just about anything you are allowed to change on a *nix box, and it is by no means limited to servers. The disadvantage of Webmin in your situation is that it must be installed and run by root, because it uses its own built-in server, rather than running through the likes of Apache. Contact your web host about this: they may have installed either Webmin or its limited cousin Usermin. If they haven't, they may be willing to, as it would benefit all customers. The may also install phpMyAdmin for you, so you don't need to take up your own space and bandwidth allowances with it.

Back to the list