Interfacing MySQL and C - mysql

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.

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

I have no experience on iOS, but the basic steps apply to linux may be helpful to you.
Since you already have the latest MySQL version, then download the right manual from here. http://dev.mysql.com/doc/
According to the manual chp.2, make and make install mysql on your computer.
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.

Related

Is there a way to downgrade mysqlbackup?

I have a client that backed up his data with MEB 4.0.0, so now I need to extract the contents of the image, but because I'm using mysql Enterprise Backup 8.0 I can't since it's not compatible.
Is there a way to downgrade my mysqlbackup? Or maybe upgrade his Image? Right now it's in .MBI so I don't see a way out of this since I can't extract and can't find the older version of the mysqlbackup anywhere.
I'm using Windows 10 btw, any help would be appreciated!
Ok I just found out, there is NO WAY do downgrade or get the installer officialy, but there is sites like archive.org that have the old installer there.
If anyone is having trouble because of this problem I suggest to look there.

Why foreman requires package foreman-mysql2-1.7.4-1.el6.noarch

Why does it requires to install it's mysql package when I already have mysql installed, I am sorry If I sound stupid but this is my learning point.
foreman-mysql would be the "foreman" side client code. My particular server doesn't have it, but it does have "foreman-postgresql" for example. This is not a "server" package, but since TheForeman works with multiple databases, it will require whatever client side code you need to support your preferred database server.
Tommy

Install MySQL on Mac OS X Lion?

I have downloaded the MySQL community server and extracted the files from the .tar file. But how do I install it? I simply cannot find a easy way to to this, or any method for that matter. Or is it already installed after tar xvf MySQL.tar? And also, when installing the .pkg version, shouldn't it create the files anywhere? Finally, the community server is the one used with django right?
Thanks in advance!
I would suggest using the .dmg version. It's an easier way of installing mysql, it can be a pain http://dev.mysql.com/downloads/mysql/
If you are developing and testing, do you really need to use MySQL? You can use sqlite which is bundled with Python.
As Vezu suggested, the best way to get started with the server is to download the binary installer - the mysql-5.5.24-osx10.6-x86.dmg file.
If you plan to use it with Python, you will also need to install MySQLdb for OSX. For that, see this answer for a link to steps you need to follow.

Where can I download source for MySQL Connector/J

Googling didn't help
Funny because copy-pasting "MySQL Connector/J" into Google got me the source code as the first result.
But if you're looking for source code for a free application, the most convenient way I've found is to look up the related package in Ubuntu (or Debian) and download the related source code.
It works best if you're using them, you can simply use aptitude search / apt-get source combo to download it. But if you're using another operating system, you can simply do a Google search like site:packages.ubuntu.com mysql connector/j
The source code for MySQL Connector/J can be found on GitHub:
https://github.com/mysql/mysql-connector-j

COCOA Objective-c : How can connect to mysql database?

I am creating application for MAC using cocoa framework, I would like to know how and what are the ways i can connect to MySql database using cocoa framework.
You might want to look into http://www.sequelpro.com/docs/Source_Code. They seem to have resurrected the original MySQL-Cocoa code and it seems to be under active development. The other option is the commercial MacSQL Framework.
Edit: You might also want to look at the following tutorial. It is a great introduction in using the libmysqlclient and even provides a sample Xcode project.
Short answer: You can't, at least not directly.
The Cocoa Framework doesn't have a database driver, generic or otherwise (CoreData notwithstanding). In order to connect to a mysql database you need to use the aptly named libmysqlclient. This library is not included with Xcode, and as such will have to be downloaded (and probably built) separately: You can get it from here.
You'll probably have to distribute the library with your application, license issues might result.
Edit: It seems as if a library for connecting to the mysql database should be installed together with a MySQL server install. If the application will only need to run on machines where MySQL is installed, you might get away with linking to this.