can't connect a mysql databse from a c programm

Hi there,

I’m trying to connect a mysql database from a c program.
Program begin like this:

#include <stdio.h>
#include <stdlib.h>
#include <mysql.h>

void main(void){

When I compile:

cc -c myprogram.c

This error is displayed:

q.c:3:10: fatal error: mysql.h: No such file or directory
 #include <mysql.h>

I had try to install (that actually I don’t know if has someting to do whit this)


Here is all code :

brownie:~ # apt-get install libmysqlclient-dev
Loading repository data...
Reading installed packages...
'libmysqlclient-devel' not found in package names. Trying capabilities.
'libmariadb-devel' providing 'libmysqlclient-devel' is already installed.
Resolving package dependencies...

Now, I’m totally lost. I really don’t know what do I have to do to connect my program with a mysql database

Any help will be very appreciated !
Thanks in advance for any feedback



Should use pkgconfig (eg in a Makefile) to check the path excluding /usr/include… or since you have the devel package installed look down in /usr/include or in /usr/share/pkgconfig/mariadb.pc this is for Tumbleweed…

#include <mysql/mysql.h>

Would probably help if you install an RPM and preferably from an openSUSE repository.
We do not support DEB packages, openSUSE is an RPM based distro.

This is probably what you need if you’re simply using the database connector, I highly doubt you need the development version if you’re not doing some kind of surgery on the connector.