Note: These instructions presume you first installed MySQL via the binary installation package and then compile the source code to get proper shared libraries.
You need to download the source to MySQL 5.1.x, it’s the tar file called mysql-5.1.xx.tar.gz (xx is version number), unpack it and open a Terminal session where you cd into the source directory and execute the following commands.
For Intel use:
CXXFLAGS="-arch x86_64" \
./configure -prefix=/usr/local/mysql \
-with-server-suffix=-standard \
-enable-thread-safe-client \
-enable-local-infile \
-enable-shared \
-with-zlib-dir=bundled \
-with-big-tables \
-with-readline \
-with-plugins=all \
-without-docs
For PowerPC use
CXXFLAGS="-arch ppc64" \
./configure -prefix=/usr/local/mysql \
-with-server-suffix=-standard \
-enable-thread-safe-client \
-enable-local-infile \
-enable-shared \
-with-zlib-dir=bundled \
-with-big-tables \
-with-readline \
-with-plugins=all \
-without-docs
Follow for both with:
And if that went without errors you are ready to install:
And now you’ve got a proper MySQL installation with shared libraries. Which means you can compile and install all kinds of software that requires access to MySQL databases.
Next step: Securing your MySQL install



9:27 am
Hi Richard,
Followed your instructions, so far no problem. But when it comes to unpack source MYSQL. Could you give some instructions on how to unpack and what the source library should be. i also have an issue with sudo command (root user). It doesn’t seem to accept my root password. I did a reset using the mac osx utitlities found on the startup CD but still no go.
Any clue
Thanks
12:21 pm
Luc,
You can easily unpack the mysql source file from within the Finder. Just double-click the .tar.gz file and it will unpack it (it will first unzip it then untar it).
You can also do it with the following terminal command :
tar -zxf mysql-5.1.36.tar.gz
Concerning your sudo problem, you should first check if your account is in the administrator group. Go in the System Preferences Panel, then in the Accounts Panel. Verify that you are authorised to administer your computer.
Once this is done, when you issue the sudo command, just type your password (your user password, not the root password) and it should work
11:36 pm
I am having trouble following your instructions. In the previous part (Installing MySQL) you had us use the dmg and the installer to install MySQL into usr/local. That part worked fine. Following your instructions above, I downloaded the tar file (which by default ends up in the downloads folder), and unpacked it. Now I opened Terminal (my default shell is tsch) and used cd to get to the new MySQL folder in the Downloads directory. (Note: I am using the PowerPC, 64-bit version). So now I start to compile. (I thought that I was supposed to compile the program in the final director which would be usr/local, but the newly unpacked files look like copies of the ones in usr/local, so I can’t move them.) Nonetheless, I copy and paste your commands into terminal and I get CFLAGS command not found. So I change the prefs in Terminal to bash and try again. This time the error is ./configure: No such file or directory. Now granted, I’m not a unix whiz, but I seem to be missing something. Is there a path missing from .bash_profile? I successfully compiled php with mcrypt, so my compiler was working fine under tsch. Any help would be appreciated.
8:29 am
David, you should have moved the downloaded mysql-5.1.X.tar.gz to another directory. Unpack it and try to compile it from there. By the wat if you are using a PowerPC these are the incorrect instructions as this set is for Intel. Please replace x86_64 with ppc64 in both flag sections.
1:58 pm
If you have a PowerPC Mac (G3, G4 or G5) you’ll need to change
CFLAGS=”-arch x86_64″ \
CXXFLAGS=”-arch x86_64″ \
to
CFLAGS=”-arch ppc64″ \
CXXFLAGS=”-arch ppc64″ \
10:24 pm
For some reason it is giving me permission denied when I perform the first set of commands above.
“-bash: ./configure: Permission denied”
I made sure I was the administrator in the accounts .
7:48 am
@Bill, you need to use a normal user account to perform the first steps. You only need an administrator account when doing the “make install”.
Did you ‘cd’ into the extracted directory ?
8:16 pm
I’m having the problem with ./configure not being found. I don’t see a configure program in the tarball.
Should a path be set in the bash shell, or is there some other problem here?
8:19 pm
@Thomas, make sure you got the correct tar file, it should be almost at the bottom of the download page called mysql-5.1.40.tar.gz
http://dev.mysql.com/downloads/mysql/5.1.html#source
10:35 pm
That fixed the problem. I don’t think it’s clear on the MySql download page that the tarballs for the various OSes are not source tarballs.
4:53 am
Does the mysql-5.1.42.tar.gz have the ./configure. my computer is saying no such file or directory
9:12 am
Yes it should, cd into the extracted mysql-5.1.42 directory and it should be there. Also make sure you have XCode installed
7:55 am
Richard, 1st thanks for this site it’s a huge help to a newbie like me.
2nd You may want to update your documentation to state that you must select “Source Code” from the “Select Platform” pull down menu on the mysql downloads page.
It took me about 4 hours to notice the “Source Code” option in the fraking pull down menu. Their page sniffs your platform and defaults to OSX (in my case) automatically and Source Code is not an option there.
8:01 am
@Sam, we’ll do thanks for letting me know.