5

Where can I find the include files for MySQL on Linux? I looked in /usr/include/mysql according to this but they are not there. My apache web server works fine with MySQL 5.1 up and running with PHP 5, but I can't find where the includes directory is!!

Thanks for your help!

2
  • what distro are you using?
    – Ophidian
    Feb 22, 2010 at 2:41
  • Ubuntu 8.10 is the distro
    – deownefin
    Feb 22, 2010 at 2:52

3 Answers 3

8
$ mysql_config --include

On my system, this prints -I/usr/include/mysql

If the directory revealed by mysql_config doesn't have the right include files, your installation may have been partial or may have been altered after the fact.

From the documentation:

mysql_config provides you with useful information for compiling your MySQL client and connecting it to MySQL....

--include

Compiler options to find MySQL include files.

2
  • not work for me, there is no mysql_config binary with mysql 5.5.35. :( Sep 24, 2016 at 18:02
  • @Jean-Luc Barat, perhaps you are missing the "devel" files. Others on even older 5.5 versions don't have that problem.
    – pilcrow
    Sep 24, 2016 at 21:22
3

This really depends on the Linux distro you are using. Most binary distros ship the headers separate from the application itself, often in a -devel package.

For instance, on my Fedora 12 machine the mysql-devel package has the following description:

MySQL is a multi-user, multi-threaded SQL database server. This package contains the libraries and header files that are needed for developing MySQL client applications.

On Fedora, CentOS, or RHEL,you can install this package by yum install mysql-devel as root. Debian and Ubuntu systems will have a similar package name and command for apt.

0
1

It worked for me by installing libmysqlclient-dev in ubuntu-14.04.

Then I could find files in /usr/include/mysql

You must log in to answer this question.