Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
what distro are you using? – Ophidian Feb 22 '10 at 2:41
Ubuntu 8.10 is the distro – deownefin Feb 22 '10 at 2:52
up vote 4 down vote accepted
$ 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....


Compiler options to find MySQL include files.

share|improve this answer
Thanks! for the response – deownefin Feb 22 '10 at 3:08

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.

share|improve this answer
Interesting thanks for your answer! – deownefin Feb 22 '10 at 3:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.