MySQL 5.1 on MacOS 10.5 filevault

First download MySQL 5.1 and MySQL 5.0. The GA versions are the ones that have the prefpanel for starting MySQL, so you have to get both the GA and RC if you want bleeding edge with the GUI startup.

Note: a configuration of this type is meant for a machine with one user since only that one user will be able to decrypt the filevault and unlock the data file location so MySQL can run.

Unpack the contents of 5.1.22 to /usr/local/mysql.

Mount the 5.0.45 dmg package and drag MySQL.prefPane to /Library/PreferencePanes. This is how I start MySQL. Do not click for MySQL to automatically start, because it won't be able to start until after you login your filevaulted account. MySQL does appear to be able to survive through putting a laptop to sleep, so you can just put your machine to sleep a lot if you don't like starting MySQL a lot.

Alternatively, command line nuts can start MySQL like this:

davidnorman:mysql root# /usr/local/mysql/support-files/mysql.server start

Create a place for the MySQL data files in your filevault. I picked /Users/davidnorman/mysql/data and made a global configuration file to match which I put in /etc/mysql/my.cnf. MySQL 5.0 expects the configuration at /etc/my.cnf and you will find if you use the MySQL 5.0 GUI tools, the configuration section will look there, too. I consider this a harmless penalty for using RC code.

[mysqld_safe]
user = davidnorman
log-error = /Users/davidnorman/mysql/data/davidnorman.local.err
basedir = /usr/local/mysql
datadir = /Users/davidnorman/mysql/data
max_allowed_packet=64M

[mysqld]
user = davidnorman
log-error = /Users/davidnorman/mysql/data/davidnorman.local.err
basedir = /usr/local/mysql
datadir = /Users/davidnorman/mysql/data
max_allowed_packet=64M

Move the contents of /usr/local/mysql/data to your /Users/davidnorman/mysql/data equivalent and run /usr/local/mysql/scripts/mysql_install_db.

Start your MySQL server through Apple menu - System Preferences - MySQL. If the status doesn't turn green, check your /Users/davidnorman/mysql/data/davidnorman.local.err equivalent. My biggest problems were from permissions, which created errors that it either it couldn't find files or they were read-only. Eventually I found

$ sudo chmod -R 700 /Users/davidnorman/mysql
$ sudo chown -R davidnorman:davidnorman /Users/davidnorman/mysql

cleared it up since during other parts of the install process things were created and owned by user root or _mysql and were in a few were in the wheel group.

Set a root password if you want.

$ /usr/local/mysql/bin/mysqladmin -u root password 'newpasswordhere'


» deekayen's blog · Delicious · Digg · Technorati Topics: · · · · ·

Thanks

Just wanted to say I've been all over looking for the best way to setup MySQL on Leopard and this was the one that worked for me. Especially like the fact my databases are encrypted in my filevault too. Thanks for taking the time to put this up.

reply

Starting Up Mysql On Leopard

I wrote a post on step by step reinstall and startup of mysql on leopard. http://www.developingchris.com/2007/10/26/mysql-and-os-x-105-leopard/

reply

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <hr /> <a> <p> <em> <strong> <cite> <code> <blockquote> <ul> <ol> <li> <dl> <dt> <dd> <div> <img> <h1> <h2> <h3> <h4> <h5>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options