Jun Kit's Tumblr |
Hello there. I'm a graduating Economics and Information Systems student based in Singapore. I get excited over iOS development and architecture and scalability issues. |
We had to work with MySQL Cluster for our midterm assignment in AA class. Most of my group members were on Macs, and we found out that there were no precompiled Mac binaries for MySQL Cluster. Furthermore, the instructions given by MySQL were misleading. Their documentation stated that
Mac OS X users should download the Quick Start Guide for Linux.
But said nothing about the fact that the Linux binaries were incompatible with Mac OS X. So after a few false starts, we realized we had to compile MySQL Cluster from scratch. Luckily, the compile was not that complicated. Here’s how we got MySQL Cluster running on our Macs.
Downloading
Since we’re compiling source code, we need our toolchain to be installed first. The Mac doesn’t come with development tools like compilers and headers by default, but you can install them by downloading and installing Xcode from the Mac App Store. Do note that Xcode is a two-step install. After the download finishes from the Mac App Store, Xcode isn’t actually installed yet. You have to look for an Install Xcode in your Applications folder, that’s the installer for Xcode. Run that and Xcode will install along with all the development tools.
The latest version of MySQL Cluster (7.2.4) as of this writing requires a more complicated build process. Thus, we’re going to use the previous version which suited our needs fine. Download the MySQL Cluster source code from http://dev.mysql.com/downloads/cluster/7.1.html#downloads. For Platform, you should select Source Code and then download Generic Linux (Architecture Independent), Compressed TAR Archive.
Compiling
Open Terminal and navigate to where the file was downloaded. In this case, it went into the Downloads directory. Then execute the following commands line by line to unpack the archive, configure the build to enable ndbcluster, compile and install the binaries.
Do note that the compile will take some time. On my Core i5 MacBook Air, it took about 10 minutes to fully compile the source.
Post-compile steps
The final step will install the MySQL binaries into /usr/local/bin and the Cluster-specific binaries into /usr/local/libexec. For most people, /usr/local/libexec is not in their path, so we should add it now. There is a file called .profile in your home directory, if you don’t have it, create it by running touch ~/.profile in the command line.
Open the file, and add the following line to the end of the file.
export PATH=$PATH:/usr/local/libexec
Save the file, and you’re done!