|
#1
| ||||
| ||||
| Compling MySQL for Mac OS X client The version of MySQL you can get from the MySQL homepage doesn't seem to have the shared libraries needed to enable PHP to connect to MySQL. Thus, we'll have to compile MySQL ourselves. Create and enter the folder we'll use to compile from: Code: mkdir -p ~/WebServer/MySQL cd ~/WebServer/MySQL Code: #!/bin/bash
if [ ! -e mysql-${1}.tar.gz ]
then
curl -O --url ftp://sunsite.dk/mirrors/mysql/Downloads/MySQL-${1%\.*}/mysql-${1}.tar.gz \
--disable-epsv --disable-eprt
fi
rm -rf mysql-${1}
tar -zxf mysql-${1}.tar.gz
cd mysql-${1}
export PATH=/Developer/Tools:/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin
# http://dev.mysql.com/doc/mysql/en/Mac_OS_X_10.x.html
export CC="gcc"
export CFLAGS="-O3 -fno-omit-frame-pointer"
export CXX="gcc"
export CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"
./configure \
--prefix=/Library/MySQL \
--exec-prefix=/Library/MySQL \
--with-extra-charsets=complex \
--enable-thread-safe-client \
--enable-local-infile \
--with-openssl \
--with-openssl-includes=/darwinports/include \
--with-openssl-libs=/darwinports/lib \
--with-zlib=/darwinports \
--enable-shared \
--enable-static
make
sudo apachectl stop
sudo SystemStarter stop MySQL
sudo rm -rf /Library/MySQL/lib /Library/MySQL/include
sudo make install
sudo SystemStarter start MySQL
sudo apachectl start
export PATH=/Library/MySQL/bin:${PATH}
mysql --version Then just execute the following command : ./mysql.bash 5.0.15 We'll also need a MySQL StartupItem (remember to make it executable with 'chmod o+x MySQL'): Code: sudo mkdir -p /Library/StartupItems/MySQL Code: #!/bin/sh
##
# MySQL Server
##
. /etc/rc.common
StartService ()
{
if [ "${MYSQL:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting MySQL Server"
cd /Library/MySQL
./bin/mysqld_safe &
fi
}
StopService ()
{
ConsoleMessage "Stopping MySQL Server"
PIDS=`ps ax | grep mysql | grep -v grep | awk '{print $1}'`
for pid in $PIDS; do
kill -KILL $pid
done
}
RestartService ()
{
StopService
sleep 3
StartService
}
RunService "$1" Code: {
Description = "MySQL Server";
Provides = ("MySQL");
Requires = ("Resolver");
OrderPreference = "Late";
Messages =
{
start = "Starting MySQL Server";
stop = "Stopping MySQL Server";
};
} Code: MYSQL=-YES-
__________________ Bjarne D Mathiesen København ; Danmark ; Europa Last edited by BjarneDM; November 5th, 2005 at 08:08 AM. |
|
#2
| ||||
| ||||
| Forgot to write, that you'll need to have installed DarwinPorts as described here: http://www.macosx.com/forums/showthr...33#post1245233 or modify the paths and replace 'darwinports' with 'usr' where appropriate.
__________________ Bjarne D Mathiesen København ; Danmark ; Europa |
|
#3
| ||||
| ||||
| Very nice step-by-step! Thanks!
__________________ Power Macintosh G4/500MHz "Yikes!" 10.4.11 Server • 1024MB • 3 x 120GB + 320GB • DVR-111D • 2 x Radeon 7000 PCI • 2 x 17" CRT MacBook 2.0GHz Core 2 Duo - White 10.5.5 • 2048MB • 80GB • CD-RW/DVD-ROM iPod Photo 60GB • iPod nano 1GB • AT&T DSL 6Mb/768k http://www.jeffhoppe.com |
|
#4
| ||||
| ||||
| Post-install If it's a first-time install, you'll have to follow the instructions given here: http://dev.mysql.com/doc/refman/5.0/...tallation.html - suitably modified of course. Also, if you want to be able to just run the MySQL commands without first cd'ing to the MySQL bin directory, you'll have to modify your PATH environment variable: Code: export PATH=/Library/MySQL/bin:${PATH}
__________________ Bjarne D Mathiesen København ; Danmark ; Europa Last edited by BjarneDM; November 20th, 2005 at 09:21 AM. |
![]() |
| Thread Tools | |
|
|