alf
alf

Reputation: 681

Interfacing MySQL and C

I have OSX Lion, which comes with Postgres, but I'd rather us MySQL. But either way, I'm pretty lost. How would I go about interfacing C with MySQL, so I can just #include "mysql.h" (or maybe some other library) and go from there. Assume that all I've done so far is download the latest MySQL version. Thank you.

Upvotes: 1

Views: 170

Answers (2)

tyger
tyger

Reputation: 181

I have no experience on iOS, but the basic steps apply to linux may be helpful to you.

  1. Since you already have the latest MySQL version, then download the right manual from here. http://dev.mysql.com/doc/
  2. According to the manual chp.2, make and make install mysql on your computer.
  3. After installing, you'll find include/mysql and lib/mysql directories under ($MYSQL_INSTALL_DIR), including mysql.h in your source file and linking appropriate .a file, then you can interfacing with MySQL(see manual Chp. APIs), maybe creating tables/insert/update etc.

Upvotes: 0

TJD
TJD

Reputation: 11896

You are on the right track, just include the headers and link against the client libraries. Documentation for the C API is here: http://dev.mysql.com/doc/refman/5.1/en/c.html

Upvotes: 1

Related Questions