installing phpMyAdmin
November 19, 2010

phpMyAdmin allows point-and-click management of MySQL databases. It's very useful, although knowing how to do the same thing with the commandline is sometimes invaluable.

Note: these instructions assume you are using Virtual Hosts in httpd.conf. They will vary slightly if used in a different configuration, such as with an alias.

Note: Ensure to install Apache and MySQL before installing phpMyAdmin.

To install phpMyAdmin:

  1. cd /usr/ports/databases/phpmyadmin
  2. make install clean

    I suggest selecting the options BZ2, GD, MYSQLI, OPENSSL, PDF, ZLIB, MYCRYPT, ZIP

Now create a new Apache virtual host:

  1. vi /usr/local/etc/apache/httpd.conf
  2. scroll to the end and insert syntax similar to the following:
    <VirtualHost *>
    DocumentRoot /usr/local/www/phpMyAdmin/
    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 MultiViews
        AllowOverride FileInfo Limit Options
        Order allow,deny
        Allow from all

Create config directory and allocate permissions:

  1. mkdir /usr/local/www/phpMyAdmin/config
  2. chmod 777 /usr/local/www/phpMyAdmin/config

Restart Apache:

  1. /usr/local/sbin/apachectl restart

Configure phpmyadmin:

  1. In a web browser, access

    Note: this address is correct for phpMyAdmin 3.3.7, other versions, probably not...

  2. click New Server button
  3. set authentication type to HTTP
  4. ensure "User for config auth" is blank
  5. click Save button

This done, now remove the config dir:

  1. rm -rf /usr/local/www/phpMyAdmin/config

Give phpMyAdmin database permissions:


As the server will likely have no DNS entry, to resolve it, add an entry to your HOSTS file. Do not use the server's IP in your browser's address bar - Apache will not know that you intend to access the phpMyAdmin virtual host, and will display the default website.