Installing phpMyAdmin on Mac OSX 10.8 Mountain Lion & 10.7, 10.6
To get simplified administration done and ‘command line’ free MySQL work, phpMyAdmin comes to the rescue, to get it running as part of your local development set up on OS X, a couple of steps need to be preconfigured.
These steps will work on both Mac OS X 10.8 Mountain Lion, 10.7 and 10.6 Snow Leopard.
Preparing for phpMyAdmin
Download the latest version now at version 4 phpMyAdmin, the english.zip should be sufficient, after the file is downloaded decompress it and move it to your personal web sharing folder “/Users/username/Sites” directory or other web root folder such as /Library/WebServer/Documents/.
Rename the folder from “phpMyAdmin-4.0.0-english” to “phpmyadmin“. The rest of the tutorial assumes that you have already mysql set up with a mysql root user and password enabled if not then please follow that process first.
The login address for phpMyAdmin is going to be http://localhost/~username/phpmyadmin/ or http://localhost/phpmyadmin/ depending on your web root directory, but before this will work correctly a few steps need to be done namely addressing the MySQL socket error and configuration file set up:
a) Launch /Applications/Utilities/Terminal to fix the mysql 2002 socket error by entering the following commands:
sudo mkdir /var/mysql sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
b) In the phpmyadmin folder in your web root make a new directory named “config”.
c) Give Others “write”permissions to the “/phpmyadmin/config” folder either through Get Info or a ‘chmod o+w’ in Terminal.
chmod o+w ~/Sites/phpmyadmin/config
Installing phpMyAdminOlder Safari browser currently has issues with the installation, blank screens?? Upgrade to Safari 6 or use either Chrome or Firefox.
Now we are ready to run the set up in the browser by going to:
The new server to be configured is the localhost, click new server and then the only other configurations are the local mysql user and the password in the Authentication tab.
Add in the username, by default “root” is assumed, add in the mysql root password, click on save and you are returned to the previous screen.
Make sure you click on save, then a config.inc.php is now in the /config directory, move this file to the root level of /phpmyadmin and then remove the now empty /config directory.
Now going to http://localhost/~username/phpmyadmin/ will now allow you to interact with your MySQL databases.
Mcrypt missing extension – If your applications don’t require the mcrypt extension there is no need to worry about it missing as reported in phpMyAdmin, if you do need to install it follow the guide here on mcrypt extension in Lion.
Upgrading phpMyAdmin is an easy task just grab the latest version from the phpmyadmin website and replace your older phpMyAdmin directory in your web shared folder apart from the “config.inc.php” file – make sure the config.inc.php is kept and put it back in the new directory.
I’ll keep this post updated at ‘coolest guy on the planet‘ as OSX and MySQL updates are rolled out.