Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install MySQL Connector/C on Mac OS X?

Tags:

c

mysql

macos

I'm writing an app in C that requires MySQL interaction, so I downloaded the Connector/C archive from the official website, and it contains bin, lib and include folders, but I don't know where to install them. I could copy the include files into my project folder, but where can I put the lib file so that my compiled binary (and other binaries) can find it?

Thanks in advance!

like image 509
klaussner Avatar asked Jan 06 '11 13:01

klaussner


People also ask

Does MySQL connector work with Mac?

macOS is based on the FreeBSD operating system, and you can normally use the MySQL network port for connecting to MySQL servers on other hosts. Installing the Connector/ODBC driver lets you connect to MySQL databases on any platform through the ODBC interface.


2 Answers

This is confusing, isn't it.. don't know why they don't make this more clear.

The lib/ files go in /usr/local/lib The include/ files go in /usr/local/include The bin/ files go in /usr/local/bin

The /usr/.. directory isn't visible through finder afaik so you have to go at it via commandline. Best of luck

Also, in your Xcode project, make sure you add a Linked Library by going to your Target's settings, General, then adding Linked Library "libmysqlclient.dylib"

like image 180
Nektarios Avatar answered Sep 19 '22 19:09

Nektarios


Alternatively, to do everything on the commandline by "mv", you could also execute (on cmdline):

defaults write com.apple.finder AppleShowAllFiles TRUE

and

killall Finder

to make the hidden folder /usr (and everything else) visible.

After placing your connector files (like Nektarios explicitly discribed where) and closing all "hidden folder - finder windows", execute on your cmd:

defaults write com.apple.finder AppleShowAllFiles FALSE

and again

killall Finder

to hide what have to be hidden.

like image 29
GreveX Avatar answered Sep 21 '22 19:09

GreveX