10.3.2 w/Security Update 2004-02-23 v1.0 broke my previous installation as it constrained write permissions in /tmp. This results in a non-intuitive "can't create socket error in the mysqllog". Giving mysql user write privs to /tmp fixed the problem.
Using Mac OSX 10.3.3 on a G5, 2ghz. For whatever reason, the mysql.socket was deleted from the hard drive. Many hours spent trying to discover why. After several reboots it reappeared. I then added a "sticky bit" to the /tmp directory: chmod +t /tmp. Checking permissions for the new mysql.socket showed a t at the very end. It's been OK ever since. Thanks to Larry Ullman, p 280, MySQL Visual Quickstart Guide.
I downloaded the 4.0.18 version for OS X with Installer and it came as a dmg with the advertised installer. I think they forgot it for 4.0.20 so let's hope they fix that at least for the next release.
Note: 4.0.19/4.0.20 has important updates for those using InnoDB on OS X with case-insensitive filesystems (eg, HFS and HFS+).
I'm running mysql 4.0.21 on a iMac 400Mhz with Mac OS 10.3.7 and since the 10.3.7 update mysql cannot write to /tmp/ so after reboot no mysql.sock is created and mysql fails. made /tmp/ writable to everyone and worked perfect!
Posted by Peter Danckwerts on February 10 2005 8:03am
Bart Kodden's comment solved my problem. After updating to OS X 10.3.7. I, too, had a permissions problem. Once I ensured that MySQL could write to /tmp/, all was back to normal. Thanks, Bart!
You cannot get MySQL version 4 for Mac OS X 10.1.x The problem is in libc that is present in Darwin 5.x and older. There is no localtime_r function there. Adding it to conditional compile of mysql may help. Specifically, the compile fails in client (surprisingly) and mysqld is built nicely.
For users of 10.1 the option is to get source version 3.23.49 and compile. The compilation goes through very smoothly. Fink says that 10.1 users should not go beyond this release -- perhaps true. I have not tested later versions in 3 series but this builds and runs while 4.x does not.
In brief, get the source and do this and in this sequence: 1. ./configure (with proper parameters given in the link to apple developer site above) 2. make 3. sudo make install
Then add user mysql and group mysql to OS X if they are not present(It is not present in 10.1 by default).
Run mysql_install_db
Change ownership of var and run directory to mysql. In case run directory is not made by installation just create it -- no problem.
Compiling client applications on Mac OS X with XCode (OS 10.4.x, XCode 2.x, MySQL 4.1.8 from the WebServerXKit distribution)
You have to add the library and include path in the "Source Tree" preferences of XCode ("/usr/local/mysql/lib/" and "/usr/local/mysql/include/"), so compiler and linker should find the files. So far i didn't bother with any gcc- or linker flags.
Explicitely add the libraries you need to your project (e.g. "/usr/local/mysql/lib/libmysqlclient.a"). You need a substitute for the "-lz" which is suggested in the manual for compress() and uncompress(). For OS X.4 add "/usr/lib/libz.dylib" to the project (which is actually a link to the most recent version shipped with the os).
#include "mysql.h" or #import "mysql.h" in the C/C++ resp. Objective-C source file provides full access to the C-API.
In Cocoa projects you should create object wrappers for MYSQL, MYSQL_RES and MYSQL_ROW. By inheriting objects like NSData or protocols like NSOutlineViewDataSource, your objects become an abstract data source for the Cocoa-API and GUI.
Posted by [name withheld] on October 20 2006 3:11am
Mac OS 10.5, Xcode 3.0, MySQL 5.0.51 (compiled by macports, your paths may vary)
Thanks to the advice above and from googling, I was able to get the client libraries working inside my Objective-C app with the following:
With your project open, In the Groups & Files Pane, right-click on the project name and select 'Get Info' to bring up the Info dialogue. Select 'Build' Under the 'Linking Pane', edit 'Other Linker Flags' and add: -lmysqlclient -lm -lz $(inherited) Under the 'Search Paths' pane edit 'Header Search Paths' and add: /opt/local/include/mysql5 $(inherited) In the same pane edit 'Library Seach Paths' and add: /opt/local/lib/mysql5/mysql $(inherited)
Use #include <mysql/mysql.h> in your header file.
The default Xcode settings compile for multiple architectures and unless you followed the cross-compiling advice above, you will probably receive an error such as this during linking: "libmysqlclient.dynlib: file is not of required architecture"
To get around this: In the same Build panel, under 'Architectures' edit 'Valid Architectures' and deselect all non-compatable processor architectures. In my case ( G4 ), I deselected ppc64, i386, and x86_64.
User Comments
what about for OS X v. 10.1? Perhaps you should at least mention 10.1.
The installer failed on my fresh Jaguar installation (10.2.8), fixing the permissions on the /usr/local/mysql/data directory seemed to have worked.
I did:
sudo chown -R mysql /usr/local/mysql/data
-S.Ryan
10.3.2 w/Security Update 2004-02-23 v1.0 broke my previous installation as it constrained write permissions in /tmp. This results in a non-intuitive "can't create socket error in the mysqllog". Giving mysql user write privs to /tmp fixed the problem.
Using Mac OSX 10.3.3 on a G5, 2ghz. For whatever reason, the mysql.socket was deleted from the hard drive. Many hours spent trying to discover why. After several reboots it reappeared. I then added a "sticky bit" to the /tmp directory: chmod +t /tmp. Checking permissions for the new mysql.socket showed a t at the very end. It's been OK ever since. Thanks to Larry Ullman, p 280, MySQL Visual Quickstart Guide.
The downloads for Mac OSX with installer and without installer are identical. It seems that you can't download mysql with an installer for Mac OSX.
I downloaded the 4.0.18 version for OS X with Installer and it came as a dmg with the advertised installer. I think they forgot it for 4.0.20 so let's hope they fix that at least for the next release.
Note: 4.0.19/4.0.20 has important updates for those using InnoDB on OS X with case-insensitive filesystems (eg, HFS and HFS+).
I'm running mysql 4.0.21 on a iMac 400Mhz with Mac OS 10.3.7 and since the 10.3.7 update mysql cannot write to /tmp/ so after reboot no mysql.sock is created and mysql fails. made /tmp/ writable to everyone and worked perfect!
Bart Kodden's comment solved my problem. After updating to OS X 10.3.7. I, too, had a permissions problem. Once I ensured that MySQL could write to /tmp/, all was back to normal. Thanks, Bart!
This note is specific to Mac OS X 10.1.x
You cannot get MySQL version 4 for Mac OS X 10.1.x
The problem is in libc that is present in Darwin 5.x and older. There is no localtime_r function there. Adding it to conditional compile of mysql may help.
Specifically, the compile fails in client (surprisingly) and mysqld is built nicely.
For users of 10.1 the option is to get source version 3.23.49 and compile.
The compilation goes through very smoothly. Fink says that 10.1 users should not go beyond this release -- perhaps true. I have not tested later versions in 3 series but this builds and runs while 4.x does not.
See http://developer.apple.com/internet/opensource/osdb.html for guidelines. The link is very good and relevant. It has all the information except adding user and group mysql on OSX 10.1
In brief, get the source and do this and in this sequence:
1. ./configure (with proper parameters given in the link to apple developer site above)
2. make
3. sudo make install
Then add user mysql and group mysql to OS X if they are not present(It is not present in 10.1 by default).
Run mysql_install_db
Change ownership of var and run directory to mysql. In case run directory is not made by installation just create it -- no problem.
Now run safe_mysqld!
Compiling client applications on Mac OS X with XCode
(OS 10.4.x, XCode 2.x, MySQL 4.1.8 from the WebServerXKit distribution)
You have to add the library and include path in the "Source Tree" preferences of XCode ("/usr/local/mysql/lib/" and "/usr/local/mysql/include/"), so compiler and linker should find the files. So far i didn't bother with any gcc- or linker flags.
Explicitely add the libraries you need to your project (e.g. "/usr/local/mysql/lib/libmysqlclient.a").
You need a substitute for the "-lz" which is suggested in the manual for compress() and uncompress(). For OS X.4 add "/usr/lib/libz.dylib" to the project (which is actually a link to the most recent version shipped with the os).
#include "mysql.h" or
#import "mysql.h" in the C/C++ resp. Objective-C source file provides full access to the C-API.
In Cocoa projects you should create object wrappers for MYSQL, MYSQL_RES and MYSQL_ROW. By inheriting objects like NSData or protocols like NSOutlineViewDataSource, your objects become an abstract data source for the Cocoa-API and GUI.
Unfortunately, Federated tables are not included in the default configuration for OS X.
If you need Federated tables, you'll have to build from source. Bummer.
If you want to build a binary which works on ppc, intel and on their 64bit variants, try this:
(done on MacOS X 10.4.8 with XCode 2.4.1)
export PATH="/usr/X11R6/bin:/usr/bin:/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin"
export LDFLAGS="-lz"
export CC=gcc
export CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -fno-omit-frame-pointer -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
export CPPFLAGS=""
export CXX=gcc
export CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -fno-omit-frame-pointer -fno-exceptions -fno-rtti -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-local-infile --disable-shared --disable-dependency-tracking --enable-thread-safe-client --enable-largefile --with-innodb --with-berkeley-db --with-big-tables --with-unix-socket-path=/tmp/mysql.sock --with-ndb-shm --with-ndb-port --with-ndb-port-base --with-comment --with-gnu-ld
Mac OS 10.5, Xcode 3.0, MySQL 5.0.51 (compiled by macports, your paths may vary)
Thanks to the advice above and from googling, I was able to get the client libraries working inside my Objective-C app with the following:
With your project open, In the Groups & Files Pane, right-click on the project name and select 'Get Info' to bring up the Info dialogue.
Select 'Build'
Under the 'Linking Pane', edit 'Other Linker Flags' and add:
-lmysqlclient -lm -lz $(inherited)
Under the 'Search Paths' pane edit 'Header Search Paths' and add:
/opt/local/include/mysql5
$(inherited)
In the same pane edit 'Library Seach Paths' and add:
/opt/local/lib/mysql5/mysql
$(inherited)
Use #include <mysql/mysql.h> in your header file.
The default Xcode settings compile for multiple architectures and unless you followed the cross-compiling advice above, you will probably receive an error such as this during linking:
"libmysqlclient.dynlib: file is not of required architecture"
To get around this: In the same Build panel, under 'Architectures' edit 'Valid Architectures' and deselect all non-compatable processor architectures. In my case ( G4 ), I deselected ppc64, i386, and x86_64.
Add your own comment.