Ditching XAMPP on OS X – Part 2 – MySQL

When trying to upgrade php in XAMPP, I ran into the problem faced when you use an all in one solution for your LAMPP development, i.e.. you’re stuck with whatever versions have been compiled in. So instead, I decided to take advantage of the built in Apache thats ships with the MacBook Pro. Now, we’re going to set up MySQL. Head over to their website and download the 64 bit package. Mount the disk image and run the installer. There’s also a preference pane installer, which handily starts and stops mysqld for you.

Okay, so open a terminal, and first off we’ll get a sequel dump of all your current databases from XAMPP:

cd /Applications/XAMPP/xamppfiles/bin
./mysqldump -u root -p --all-databases > /Users/delboy1978uk/Desktop/all_dbs.sql

You can now import that to your new MySQL server. It’s nice to be able to call mysql from any folder, so we’ll symlink it:

sudo ln -s /usr/local/mysql/mysql /usr/bin/mysql

You can now run mysql like so:

mysql -u root

Sudo nano /etc/php.ini, PDO is enabled by default on mac, but we need to set where the MySQL socket is:


Restart Apache, and we’re good to go!

sudo apachectl restart