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

I have messed with symlinks and libraries in /usr/lib. I modified libraries like libmysql*. someone suggested to reinstall libmysqlclient-dev package. Is libmysqlclient-dev holding Mysql libraries?

How can I force the re-installation of libmysqlclient-dev?

I am using Ubuntu Server 10.04 and current Mysql, 5.1.x. I need to use the server to host a Rails application and I need to compile the mysql2 gem, which is failing.


I have removed libmysql* files and mysql directory under /usr/lib. Then I purged and reinstalled mysql server, client and libmysqlclient-dev but I get:

mysql: error while loading shared libraries: cannot open shared object file: No such file or directory

I need to know which package install the shared libraries and how to fix it.

share|improve this question
Can you locate your the mentioned library? Use: sudo updatedb. Then, use: locate – Khaled Dec 10 '11 at 10:48

These are the install commands for Ubuntu for installing MySQL with Ruby.

sudo apt-get install mysql-server mysql-client
sudo apt-get install libmysql-ruby libmysqlclient-dev
sudo gem install mysql

Referenced from Ubuntu community site:

share|improve this answer
this does not answer to my question by thank you. I am using mysql2 gem, Ubuntu old ruby packages and informations. – rtacconi Dec 10 '11 at 10:19

The libmysqlclient-dev library contains the development files (headers) which are usually stored under /usr/include/. Here, you can see that most of the files provided are .h files. Such a library is useful when you want to build an application from source.

You can try to remove the package and reinstall it again. It did not work, you may need to try fixing what you have done manually.

$ sudo apt-get purge libmysqlclient-dev    # remove completely with configs
$ sudo apt-get install libmysqlclient-dev
share|improve this answer

Use dpkg -S to figure out which package the file /usr/lib/ is from, I don't think it's from libmysqlclient-dev, but from libmysqlclient, the dpkg -S command is to verify its origin...

Uninstall and reinstall the resulting package. After reinstall, run ldconfig to force your system to rebuild the symlink structures inside /usr/lib.


Just did a quick 10.04 install to verify. /usr/lib/ comes from package libmysqlclient16. So to come back to your question: No, the package libmysqlclient-dev does not hold the libraries your are looking for.


sudo apt-get purge libmysqlclient16


sudo apt-get install libmysqlclient16

The install of the package should also trigger a run of ldconfig.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.