Web www.freebsdmadeeasy.com
Main Menu

Using phpMyAdmin to manage a MySQL server

phpMyAdmin is an extremely useful tool for managing a MySQL, it allow you to perform queries, create new tables, add databases, backup existing ones, and much more.

Installing phpMyAdmin

phpMyAdmin can be installed from the ports with the following commands

# cd /usr/ports/databases/phpmyadmin
# make install

Configuring phpMyAdmin

phpMyAdmin will install to /usr/local/www/phpMyAdmin by default. To access it you can either set up the alias as the install tells you, or you can create a virtual host for it so you can access it from a domain such as phpmyadmin.yourdomain.com. If you have it accessible to the outside world you need to password protect the directory so that others do not have full access to your database. These can be done by adding the following to your httpd.conf

<VirtualHost *:80>
DocumentRoot /usr/local/www/phpMyAdmin
ServerName phpmyadmin.yourdomain.com
CustomLog /usr/local/www/logs/phpmyadmin-access_log combined
ErrorLog /usr/local/www/logs/phpmyadmin-error_log

<Directory "/usr/local/www/phpMyAdmin">
Options Indexes FollowSymLinks
AllowOverride AuthConfig
Order deny,allow
Allow from all

Before opening it in your web browser you will need to edit the phpMyAdmin config file and give it the details of your MySQL server.

# cp /usr/local/www/phpMyAdmin/config.default.php /usr/local/www/phpMyAdmin/config.inc.php

The config file is located at /usr/local/www/phpMyAdmin/config.inc.php To get on your server you must change the following lines if you have changed your root password on your MySQL server.

$cfg['Servers'][$i]['user']	= 'root';
$cfg['Servers'][$i]['password']	= 'your_pass';

Now you are ready to point your web browser at your phpMyAdmin URL and begin managing your server.