MySQL+PHP setups over SSH

September 28, 2007

I noticed I was doing this over SSH for practically every server so thought I might write down the steps in case anyone else needs them. The process is pretty much the same every time so this could almost be wrapped into a script.

1. Grab MySQL and PHP

I like to use the official MySQL and Marc Liyenage’s PHP packages. Both are in this case running on 32bit PPC (an XServe G4) using Apache 1.3 on OS X Server 10.4.x.

curl -O
curl -O

2. Unpack and install

hdiutil attach mysql-5.0.45-osx10.4-powerpc.dmg
cd /Volumes/mysql-5.0.45-osx10.4-powerpc
sudo -s
installer -pkg mysql-5.0.45-osx10.4-powerpc.pkg -target /
installer -pkg MySQLStartupItem.pkg/ -target /
installer -pkg entropy-php.mpkg -target / 

###3. Start MySQL, restart httpd###

/Library/StartupItems/MySQLCOM/MySQLCOM start
apachectl restart

Then just give your MySQL root user a proper password:

/usr/local/mysql/bin/mysqladmin -u root password "newpass"

… set up your MySQL accounts and that’s pretty much it. If you were using Apple’s PHP distribution before, you’ll have to comb /etc/httpd/httpd.conf for any traces of PHP 4. I’ve also had one situation where a MySQL 5 upgrade destroyed a previous database so it might be a good idea to back those up first.

It’s also handy to make your mysql command point to the right one:

export PATH=$PATH:/usr/local/mysql/bin
which mysql