Installing MySQL5 with Darwin Ports

Or why OSS can be like Glasgow buses

I have a very poor record when it comes to public transport in Glasgow: 100% of the buses I’ve been on have broken down. Given that the number of data samples is equal to one, however, this is not a terribly useful statistic. My track record with the amazingly cool Darwin Ports is not much better, but at least then you’re postively encouraged to try and fix it yourself.

This post describes what happened when I tried to install MySQL5 with Darwin Ports, the checksum error that appeared, and what I did to work around it. I’m sure there is a better solution, but this worked for me.

I’d ran the command:

sudo port install mysql5 +server

Unfortunately I got the following:

---> Fetching mysql5

---> Attempting to fetch mysql-5.0.19.tar.gz from http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/

---> Attempting to fetch mysql-5.0.19.tar.gz from http://mysql.he.net/Downloads/MySQL-5.0/

---> Verifying checksum(s) for mysql5

Error: Checksum (sha1) mismatch for mysql-5.0.19.tar.gz

Error: Target com.apple.checksum returned: Unable to verify file checksums

Error: /opt/local/bin/port: Status 1 encountered during processing.

Turns out that mysql.mirrors.pair.com/Downloads/MySQL-5.0 no longer had 5.0.19.tar.gz, and so returns a 404, so ports goes on to the next mirror in the Portfile, which is mysql.he.net/Downloads/MySQL-5.0. For some reason this returns a 302 instead, and the error page gets downloaded into /opt/local/var/db/dports/distfiles/mysql5. Naturally the checksum of the error page doesn't match the Portfile’s checksum, so the installation bails.

After cleaning the install to remove the bogus mysql-5.0.19.tar.gz file, edited the Portfile in /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/databases/mysql5/Portfile and removed the line:

http://mysql.he.net/Downloads/MySQL-5.0/\

Then tried running port again, this time with a bit more verbosity:

sudo port -d -v install mysql5 +server

Which resulted in the much happier:

---> Attempting to fetch mysql-5.0.19.tar.gz from http://mysql.orst.edu/Downloads/MySQL-5.0

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

100 18.5M 100 18.5M 0 0 59139 0 0:05:28 0:05:28 --:--:-- 60308

---> Verifying checksum(s) for mysql5

DEBUG: Executing com.apple.checksum (mysql5)

---> Checksumming mysql-5.0.19.tar.gz

DEBUG: Correct (sha1) checksum for mysql-5.0.19.tar.gz

After that mysql-5.0.19 was successfully installed. The failure to install was a combination of a number of factors: the port maintainer was using 5.0.19; this version was no longer on the main mysql download site; the second download site returned an error page which got downloaded instead; and so on. The good thing — unlike when buses break down — is that you can jump in and get it going again.

Post your own comment here: