mysql.h file can't be found
The mysql.h
file from the libmysqlclient-dev
Ubuntu package is located at /usr/include/mysql/mysql.h
.
This is not a standard search path for compilers, however /usr/include
is.
You'd typically use the mysql.h
header in your code like this:
#include <mysql/mysql.h>
If you don't want to specify the directory offset in your source, you can pass the -I
flag to gcc (If that's what you are using) to specify an additional include search directory, and then you wouldn't need to change your existing code.
eg.
gcc -I/usr/include/mysql ...
just use
$ apt-get install libmysqlclient-dev
which will automatically pull the latest libmysqlclient18-dev
I have seen older versions of libmysqlclient-dev (like 15) puts the mysql.h in weird locations e.g. /usr/local/include etc.
otherwise, just do a
$ find /usr/ -name 'mysql.h'
and put the folder path of your mysql.h
with -I flag in your make file. Not clean but will work.
For CentOS/RHEL:
yum install mysql-devel -y