You need to download the Source to MySQL 5, it’s the tar file called mysql-5.0.45.tar.gz, unpack it and open a Terminal session where you cd into the source directory and execute the following commands. Please note the different configure instructions for Intel or PowerPC based Macs:
Tiger 10.4.x, for Intel:
./configure --prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--libexecdir=/usr/local/mysql/bin \
--libdir=/usr/local/mysql/lib \
--with-server-suffix=-standard \
--enable-thread-safe-client \
--enable-local-infile \
--enable-shared \
--with-zlib-dir=bundled \
--with-big-tables \
--with-readline \
--with-archive-storage-engine \
--with-innodb \
--without-docs \
--without-bench
Tiger 10.4.x, for PowerPC:
./configure --prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--libexecdir=/usr/local/mysql/bin \
--libdir=/usr/local/mysql/lib \
--with-server-suffix=-standard \
--enable-thread-safe-client \
--enable-local-infile \
--enable-shared \
--with-zlib-dir=bundled \
--with-big-tables \
--with-readline \
--with-archive-storage-engine \
--with-innodb \
--without-docs \
--without-bench
Leopard 10.5.x, for PowerPC and Intel:
--localstatedir=/usr/local/mysql/data \
--libexecdir=/usr/local/mysql/bin \
--libdir=/usr/local/mysql/lib \
--with-server-suffix=-standard \
--enable-thread-safe-client \
--enable-local-infile \
--enable-shared \
--with-zlib-dir=bundled \
--with-big-tables \
--with-readline \
--with-archive-storage-engine \
--with-innodb \
--without-docs \
--without-bench
For all:
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



11:08 pm
Does your method need to be modified for the Max Version of MySQL?
11:53 pm
I’m also curious about the Max version…
Also, I noticed Apple (http://developer.apple.com/internet/opensource/osdb.html) recommends:
./configure –prefix=/usr/local/mysql
–with-unix-socket-path=/usr/local/mysql/run/mysql_socket
–with-mysqld-user=mysql –with-comment –with-debug
Not being especially conversant in the ways of compiling from source, does the last of the
–with-unix-socket-path
–with-mysqld-user
–with-comment
–with-debug
directives in your suggested configuration matter? Would adding them to your suggested configuration do harm?
Thanks as always!!
9:39 am
@ ajgB: I haven’t tried the MAX version myself so I couldn’t tell
@Jeff: debug and comment don’t really add value and decrease performance (debugging). Socket path is defaulted in my setup but can be configured in config and the same goes for the mysql user. See: http://dev.mysql.com/doc/refman/5.0/en/mysql-binaries.html on how MySQL compiles the binaries for Mac OS X
1:47 am
Well, the good news is I’m well up and running on 5.0.33 thanks to Richard’s generous help and support!
What I found, however, is there are a few things that need to be done (in addition to the steps outlined on the “securing MySQL” in this set of docs…
Right after installing, you need to run mysql_install_db as outlined here:
http://dev.mysql.com/doc/refman/5.0/en/unix-post-installation.html
be sure to do this BEFORE you start the server (mysqld or any other flavor). and you can forgo specifying basedir, etc if your run it from /usr/local/mysql (the way Richard’s configure command is set up).
If you’re upgrading from 4.1.xx to 5.0.xx and you are not installing over a previous version (say you are using Apple’s version, or Marc Liyanage’s 4.1.10a package or a previous MySQL package, all of which create new directories and do not overwrite old installs), you need to move your data.
You can use PHPMyAdmin to do this, or the backup procedures outlined on the MySQL site. You can also use:
cd /usr/local/mysql
sudo cp -R -p /usr/local/mysql-old-version-dir/data data
which will move the data over, but then you MUST upgrade your tables and permissions with mysql_upgrade as outlined here:
http://dev.mysql.com/doc/refman/5.0/en/mysql-upgrade.html
I hope this helps for those situations where you are moving from a package to compiling with Richard’s excellent instructions!
2:44 am
I’m a real UNIX newbie, and I’m having some problems with the recompile. Whenever I get to the end of the cat process the server attempts to start after I return. I have tried to control C out of the process in order to make, but I get an error saying there is no file or directory to “make”. Any help would be appreciated.
Thanks in advance.
Matt Fosberg
7:46 pm
Hi -
I am not clear why you recommend first installing the pre-compiled binary package, and then compiling and installing from source. What is the advantage of doing both rather than just the latter?
After the second step I have MySql in both /usr/local/mysql and /usr/local/mysql-5.0.45-osx10.4-i686. The former is no longer a link to the latter but a full working installation!
I had assumed that by doing both I should have the advantage of the SystemPreferences MySql control panel, but it after compiling and installing into /usr/local.mysql this is no longer able to start/stop mysql.
What am I missing??
Regards
C
8:09 pm
The choice of installing the package and the source afterwards was made because if I only documented how to install the source version I would need to document a lot of steps one had to take after installing via source. Have a look here on some of the steps. The binary install takes care of these steps which makes it a lot easier for noobs to install and run.
About the symlink issue, I haven’t noticed this problem and I think something went wrong on your source install. I’ve tried it myself and can’t reproduce it…
3:55 pm
I’m trying to install this on 10.3. I’m quite new to installing from source. After I enter the first chunk of text, everything looks fine, but when I enter “make”, it says “make: *** No targets specified and no makefile found. Stop.” I was wondering if this could have anything to do with the fact that the first line of the first chunk of code mentions 10.4. Thanks!
6:00 am
I am trying to install the mail system on a brand new Mac Mini. I have to run the ./configure command with sudo otherwise it says:
chown: /Users/myname/Desktop/mysql-5.0.45-osx10.4-i686/data/Mail-Server.local.err: Operation not permitted
If I then type make I get:
make: *** No targets specified and no makefile found. Stop.
Now after putting the sudo in front, it runs for a while but just stops at:
Mail-Server:~/Desktop/mysql-5.0.45-osx10.4-i686 myname$ Starting mysqld daemon with databases from /Users/myname/Desktop/mysql-5.0.45-osx10.4-i686/data
STOPPING server from pid file /Users/myname/Desktop/mysql-5.0.45-osx10.4-i686/data/Mail-Server.local.pid
070921 14:55:26 mysqld ended
Any suggestions?
James.
8:38 am
OK. I just worked out why the ./configure did not work. I read through all the comments on Richard’s other site (switch.richard5.net) and found one by TigerKR on 2 July 07. I had downloaded the .tar file in the section under the package section. So don’t use a .tar file that has the OS name in it. TigerKR’s comment:
>the source is AT THE BOTTOM OF THE WEB PAGE, under the heading Source >downloads NOT Mac OS X (package format) downloads and NOT Mac OS X (TAR >packages) downloads. You can use this link to get to the source download:
>http://dev.mysql.com/downloads/mysql/5.0.html#source
Configure worked fine from that.
8:42 am
Well, the configure worked, but make doesn’t! I’m getting these errors:
adler32.c:149: fatal error: opening dependency file .deps/adler32.Tpo: Permission denied
compilation terminated.
make[2]: *** [adler32.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
James.
2:36 am
Reason for the permission denied error was because I put ’sud’ before the configure command.
8:21 pm
I kept having the PID error and could not get mysql started. I could not find the answer I needed anywhere online.
Here’s my situation and fix!
After installing Leopard (clean install), I bypassed the MySQL issue by trying out XAMPP. This worked until I wanted to extend functionality with MagickWand, so I realized I’d need access to the real deal. I could not get mysql working until I opened Activity Monitor and saw there was an instance of mysqld running. I quit that, and MySQL finally started for me!
I hope this may help some frustrated person out there : )
10:15 pm
OK, I had some success with your directions on Tiger, but I’m stumbling a bit with a clean installation of Leopard…
After installing MySQL and following your instructions in “MySQL has some issues with Leopard,” I wasn’t able to manually start MySQL until I typed the following: “sudo /usr/local/mysql/support-files/mysql.server start” The system responded with “Starting MySQL” and “SUCCESS!” (I found this at http://stringfoo.com/2007/11/05/server_setup_on_leopard/#loadMySQL). Is there a more direct way of starting and stopping MySQL without the Preference Pane function? Am I missing something?
10:21 pm
Mark, you are correct. The preference pane issue is an official bug and it won’t work. You’ll need to start it manually, sorry…
I think you can also use the startup script that get’s installed if you select it in the binary install package `sudo /Library/StartupItems/MySQLCOM/MySQLCOM start`
5:30 pm
Thanks for the tip Adam, worked for me.
7:54 pm
After you type “make” is it normal for text to fly across the terminal extremely fast and take a really long time?
If not, oh crap.
3:57 pm
Yes that is correct. You only need to read the last lines to make sure everything went allright.
3:04 am
I am a Terminal/compiler newbie, so this maybe a simple fix. I have tried multiple times with clean installs, however at the end of the ./configure command it states that I am missing libm.a which I can not find. Is there other options to load for XCode?
It seems to list a lot of .h files that are missing.
Using Tiger 10.4.11, PPC, mysql 5.0.51b
8:50 pm
Shane needed to re-install XCode to get it all working again.
10:16 am
Do you have to delete the previous mysql before you re-compile?
10:56 am
No William you don’t need to do that, the new version will install over the current one.