MySQL Installation – Installing MySQL 5.1 Alongside MySQL 5.5 on Mac OS X

installationmac os xmysql-5.1mysql-5.5

mysql 5.5 is installed. I need 5.1 to install an old website so it can be updated. The installer refuses to let me install onto the disk with 5.5. I don't have any other disks. I downloaded the package file DMG. Help? Can I get around this with a different kind of source file?

Best Answer

I'm no expert on Mac OS X, but on Linux, it's relatively easy to have more than one install running side by side.

I follow a procedure very much based on the one here.

Download the source code. Gunzip and untar it. As a sister directory to the unzipped and untarred one, create a directory (I call it "sandbox"). From within sandbox, run "cmake ../", then "make" and then "make package". Then I copy the package up a level, gunzip and untar it and run the ./scripts/mysql_install_db --defaults-file=.

It's the --defaults-file (i.e. my.cnf) that's critical. In there you override the normal defaults - otherwise multiple MySQLs on the same machine will just overwrite each other's settings. I've appended a sample of my own file below. I just put all the extra stuff into the --basedir directory and that normally works a treat. Things like the socket, pid-file and, of course, the port need to be changed.

You may be able to just run the binary install script with the --defaults-file and get your system up and running without having to compile, but as I said, I'm not that familiar with OS X.

[EDIT]

Forgot to mention that you have to kick off the daemon with --defaults-file (my.cnf) also.

From your base-dir issue the command

./bin/mysqld --defaults-file=<full_path_to_my.cnf>

============== sample --defaults-file =====================

pol@pol-laptop02:~/Downloads/mysql/src/mysql-5.6.19-linux-x86_64$ more my.cnf 
[mysqld]
#
# * Basic Settings
#
user        = pol
pid-file    = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/mysqld.pid
socket      = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/mysql.sock
port        = 3306
basedir     = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64
datadir     = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/data
tmpdir      = /tmp
pid-file    = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/mysql.pid
lc-messages-dir = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/share
lc-messages = en_US

general_log     = on
general_log_file= /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/logfile.txt

log_error   = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/error.log
log-error   = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/error.log

slow_query_log_file = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/slow_query.log
slow_query_log  = 0

explicit-defaults-for-timestamp = TRUE

#language   = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/share/english

# bind-address  = 0.0.0.0 - may not need c.f. host...

[client]
port        = 3306
socket      = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/mysqld.sock
host            = 127.0.0.1
# or maybe localhost... cf. bind-address above...

# added from http://dev.mysql.com/doc/refman/5.6/en/load-data-local.html
# to allow for abrowse to load data!
#loose-local-infile =   1

local-infile    = 1 

[mysqld_safe]
#user       = linehanp
#socket     = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/mysql.sock
#err-log        = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/error.log
#pid-file   = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/mysql.pid
#log_error  = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/error.log
#log-error  = /home/pol/Downloads/mysql/src/mysql-5.6.19-linux-x86_64/error.log



pol@pol-laptop02:~/Downloads/mysql/src/mysql-5.6.19-linux-x86_64$