# Snort/Barnyard error: Unable to find mysqlclient library

## johnnydepp74

Hi Gentoo gurus,

I have seen quite a number of ppl complaining abt the following mysqlclient library error:

checking for mysql_real_connect in -lmysqlclient... no

**********************************************

  ERROR: unable to find mysqlclient library

  checked in the following places

        /usr/local/mysql/lib/mysql

**********************************************

I've tried a lot of fixes, still no solution yet, here's my info:

barnyard0.2.0# ./configure --enable-mysql --with-mysql-includes=/usr/local/mysql/include/mysql/ --with-mysql-libraries=/usr/local/mysql/lib/mysql/ > logreport

inside /etc/ld.so.conf:

/usr/local/lib

/usr/local/mysql/lib/mysql

I have also already run "ldconfig -v".

linux:/usr/local/mysql/lib/mysql # ls -l

-rw-r--r--  1 root mysql  12158 Oct  4 18:42 libdbug.a

-rw-r--r--  1 root mysql  47620 Oct  4 18:42 libheap.a

-rw-r--r--  1 root mysql  14676 Oct  4 18:42 libmerge.a

-rw-r--r--  1 root mysql 358764 Oct  4 18:42 libmyisam.a

-rw-r--r--  1 root mysql  27474 Oct  4 18:42 libmyisammrg.a

-rw-r--r--  1 root mysql 501116 Oct  4 18:43 libmysqlclient.a

-rwxr-xr-x  1 root mysql    879 Oct  4 18:43 libmysqlclient.la

lrwxrwxrwx  1 root mysql     24 Oct  4 18:43 libmysqlclient.so -> libmysqlclient.so.14.0.0

lrwxrwxrwx  1 root mysql     24 Oct  4 18:43 libmysqlclient.so.14 -> libmysqlclient.so.14.0.0

-rwxr-xr-x  1 root mysql 415496 Oct  4 18:43 libmysqlclient.so.14.0.0

-rw-r--r--  1 root mysql 255772 Oct  4 18:42 libmystrings.a

-rw-r--r--  1 root mysql 271234 Oct  4 18:42 libmysys.a

-rw-r--r--  1 root mysql 115304 Oct  4 18:42 libnisam.a

-rw-r--r--  1 root mysql   5960 Oct  4 18:42 libvio.a

-rw-r--r--  1 root root       0 Oct  9 06:53 logreport

# ls -l /usr/lib/libmysql*

lrwxrwxrwx  1 root root      24 Oct  6 09:01 /usr/lib/libmysqlclient.so.14 -> libmysqlclient.so.14.0.0

-rwxr-xr-x  1 root root 1154364 Sep 10  2005 /usr/lib/libmysqlclient.so.14.0.0

lrwxrwxrwx  1 root root      26 Oct  6 09:01 /usr/lib/libmysqlclient_r.so.14 -> libmysqlclient_r.so.14.0.0

-rwxr-xr-x  1 root root 1158560 Sep 10  2005 /usr/lib/libmysqlclient_r.so.14.0.0

l# ls -l /usr/lib/mysql/

lrwxrwxrwx    1 root root    27 Oct  6 09:01 libmysqlclient.so.14 -> ../libmysqlclient.so.14.0.0

lrwxrwxrwx    1 root root    27 Oct  6 09:01 libmysqlclient.so.14.0.0 -> ../libmysqlclient.so.14.0.0

lrwxrwxrwx    1 root root    29 Oct  6 09:01 libmysqlclient_r.so.14 -> ../libmysqlclient_r.so.14.0.0

lrwxrwxrwx    1 root root    29 Oct  6 09:01 libmysqlclient_r.so.14.0.0 -> ../libmysqlclient_r.so.14.0.0

Many apologies, I'm not that familiar with links, anything I may have missed out based on the directories listings above??

I even amended the configure script to:

LIBS="${LIBS} -lz -lssl -lcrypto -lmysqlclient" 

Any kind gurus can help ? I'm a new linux user, simple instruction commands will be greatly appreciated.

Rgds

John

----------

## Hagar

mysql, snort and barnyard are all available in portage.

Why on earth would you, as a beginning user, not take advantage of that?

----------

## johnnydepp74

Hi Hagar, thanks for your reply.

I was previously able to setup MySQL, Barnyard and Snort as a 3-tier fashion previously i.e. Sensor, Database collector and Reporting console separate boxes, way back about 1.5 years ago. This was possible when using redhat, suse or other distros.

This setup is targeted more for very large stable production use (esp to help our regional admin guys) and I'm not sure whether it's because of upgrades to the MySQL or Snort that causes this error message when previously i didnt face such problems.

We already have been using the previously successful documented steps till lately when we use higher versions of MySQL and Snort, only then we faced this issues.

I will of course look into the possibility of using portage (a new learning curve again?  :Smile:  ) if I cant get any solutions to the current problem.

Cheers!!

John.

----------

## Hagar

I'm asking cause the directory structure seems rather messy and this makes it very easy to mix different installations of the same libraries.

And that causes a lot of trouble when you try to hunt down bugs.

To give an example:

Inside /usr/local/mysql/lib/mysql:

```
-rwxr-xr-x 1 root mysql 415496 Oct 4 18:43 libmysqlclient.so.14.0.0
```

And inside /usr/lib/:

```
-rwxr-xr-x 1 root root 1154364 Sep 10 2005 /usr/lib/libmysqlclient.so.14.0.0
```

Same library name and version, different size and date.

This *is* an accident waiting to happen, even if you do manage to get it going this time.

You can avoid a lot of these things by using a package manager like portage.

----------

## johnnydepp74

Thanks Hagar for your valuable advice.

I totally agree with you. Hehe.. I also found the solution to the problem.

do a "vi /barnyard source folder/configure"

search for "LIBS=" and take out the lz and lssl keyword.

Cheers!!

Rgds

John

----------

