Installing phpMyAdmin on OS X Server

Photo of Greg
Photo by @yakobusan - http://flic.kr/p/4HiB6W

Installing the familiar web-based phpMyAdmin on OS X Server is quick and easy, and in some cases it offers a more straightforward way of managing your MySQL databases than a native Mac client.

As I mentioned in an earlier article (“Installing, Configuring and Performance Tweaking MySQL for OS X Server”), for native Mac-based database management, Sequel Pro does a great job, but a few things — such as keeping tabs on MySQL status and performance — I still find easier with good old phpMyAdmin. Installing it on your server is straightforward. Start by downloading it and expanding the archive to wherever you’d like to access it. If you’ve followed the suggestion to restrict access to your primary domain, reserving it only for administrative purposes (“At Last — Firing Up OS X Server”), the /Default site folder is probably as good a place as any.

You’ll probably want to drop the version number off the end of the expanded directory and lowercase it — so it’s just ‘phpmyadmin’ or some other name of your choosing. You’ll also need to create a ‘config’ directory inside, temporarily enabling write permissions, and if you’re using a single web manager account (“Basic Configuration and Preparing the Way for Extra Software OS X Server Needs”), you’ll also want to set ownership to that account. So, after dropping the expanded and renamed ‘phpmyadmin’ folder into the /Default site:

sudo mkdir phpmyadmin/config

sudo chown -R webadminaccount:staff phpmyadmin

sudo chmod 757 phpmyadmin/config

Now visit the new phpMyAdmin installation over SSL (if you’ve configured your server’s default certificate, or over a plain connection if not):

https://example.com/phpmyadmin/setup/

It’s a good idea to configure phpMyAdmin to force an SSL connection (which obviously requires that you have set up your server to use the default certificate).

Force SSL option for phpMyAdmin

Explicitly adding a new server during the configuration stage is entirely unnecessary, and in some ways it is preferable not to do so.

With ‘Force SSL connection’ set up, just hit ‘Save’ from the main screen, and you’re good to go: you should see a message about copying the file which phpMyAdmin will have saved to /config/config.inc.php to the top level phpmyadmin directory and deleting the /config directory. Do that, and phpMyAdmin is ready for use at:

https://example.com/phpmyadmin/

When you’re asked by phpMyAdmin itself to log in — as distinct from the digest authentication you have hopefully set up to protect the whole of your main domain, as per the earlier “Password Protecting Directories, Files or Whole Domains via a Web App” article — the details to supply are either the root MySQL username and password or the username and password of any individual MySQL user you have previously set up.

If you use phpMyAdmin’s ‘Status’ to keep tabs on your MySQL installation’s performance, you may be able to identify several areas for improvement in terms of configuration, relative to the default configuration. Also, note that if you’re logged in via screen sharing and use the OS X pref pane for MySQL to stop and start the service, you may notice a number of ‘Aborted connects’ associated with each use of the pref pane. You can use the following from the command line to avoid interacting with the pref pane altogether:

sudo /usr/local/mysql/support-files/mysql.server stop

sudo /usr/local/mysql/support-files/mysql.server start

sudo /usr/local/mysql/support-files/mysql.server restart

Also, if you use phpMyAdmin to upload database dumps/export files, you may need to tweak the following lines in your php.ini file, which restrict the maximum size of uploads and POST data, respectively:

upload_max_filesize = 2M
post_max_size = 8M

(These days, both default values seem a bit stingy.)

All material on this site is carefully reviewed, but its accuracy cannot be guaranteed, and some suggestions offered here might just be silly ideas. For best results, please do your own checking and verifying. This specific article was last reviewed or updated by Greg on .

This site is provided for informational and entertainment purposes only. It is not intended to provide advice of any kind.