Learn how to install libmysqlclient-dev on Ubuntu with clear steps, real commands, and simple explanations. Fix errors fast and get your MySQL builds working again. Our Linode Live Support Team is always here to help you.


If you’ve been trying to install libmysqlclient-dev and keep facing missing packages, build failures, or outdated tutorials, you’re definitely not the only one. Developers run into this issue all the time, especially when compiling apps that depend on MySQL. So here’s a clean, human-written walkthrough that actually helps.

install libmysqlclient-dev

Update Your System First

Before you attempt anything else, update your package list. Many people skip this and then wonder why Ubuntu can’t locate the package. So begin with:

sudo apt-get update

This step matters because Ubuntu won’t fetch new packages unless the list is refreshed.

Install libmysqlclient-dev Using Apt

Once the update completes, you can finally run the command to install libmysqlclient-dev. This is the exact package that delivers MySQL development headers and libraries:

sudo apt-get install libmysqlclient-dev

Even though it looks simple, this command fixes a huge chunk of errors developers face while building PHP extensions, Python drivers, and C/C++ applications.

Check If the Package Is Already Installed

Although many users jump straight to installation, it’s useful to check whether the package exists on your system. And you can verify it with:

dpkg -L libmysqlclient-dev

If it’s missing, Ubuntu will display:

Package `libmysqlclient-dev` is not installed.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents

From there, return to the previous command and install libmysqlclient-dev again.

Why This Package Matters During Builds

Now here’s what most guides skip: what happens after you install libmysqlclient-dev?
Your compiler finally gains access to:

  • mysql.h header
  • libmysqlclient.so library
  • MySQL configuration tools

This instantly resolves common issues like:

  • “mysql_config not found”
  • “fatal error: mysql.h: No such file or directory”
  • “undefined reference to mysql_init”

These errors appear because the server package (MySQL) is different from the development library package. So even if MySQL runs fine, your builds will still fail without the dev files.

Get MySQL Builds Running Now!

Chat animation


Conclusion

Once you successfully this, your environment becomes ready for compiling modules, building connectors, and running legacy applications without interruptions. And if you’re maintaining older Ubuntu servers, this tiny library often becomes the key to keeping things running smoothly.