Solved

mysql - missing libmysqlclient.so.18

Posted on 2012-03-20
17
5,801 Views
Last Modified: 2012-03-20
I am writing a C program to run as a cron job on a linux server and do some calculations in the MySql DB.

I have Ubuntu 8.04.3 and MySql 5.5.

I am including <mysql.h>, but when I run the program, I get:
error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

Adapting what I found via Google, I tried
sudo apt-get install libmysqlclient18-dev
only to be told
E: Couldn't find package libmysqlclient18-dev

What do I need to do to resolve this?

Thanks!
0
Comment
Question by:Daniel Wilson
  • 10
  • 6
17 Comments
 
LVL 11

Expert Comment

by:legolasthehansy
ID: 37744520
Try this
Under /usr/local/mysql/lib (or wherever you MySQL libraries live)
do "ls -l | grep libmysqlclient*"
If you do find libmysqlclient.so.15 or libmysqlclient.so.16
do
cd /usr/local/mysql/lib
#create a soft link
ln -s libmysqlclient.so.15 libmysqlclient.so.16
ldconfig

Good luck
0
 
LVL 2

Expert Comment

by:vvojtek
ID: 37744531
Hi,

Did you update apt source ?

apt-get update and then try install
0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 37744577
running apt-get update prior to the install didn't help.

As for the soft link ... I'm looking for the right place to do that.

dwilson@williamston:/$ sudo find / -name 'libmysqlclient*' 2>/dev/null
/var/lib/dpkg/info/libmysqlclient15off.list
/var/lib/dpkg/info/libmysqlclient15off.shlibs
/var/lib/dpkg/info/libmysqlclient15off.postinst
/var/lib/dpkg/info/libmysqlclient15off.postrm
/var/lib/dpkg/info/libmysqlclient15off.md5sums
/var/cache/apt/archives/libmysqlclient15off_5.0.51a-3ubuntu5.4_i386.deb
/var/cache/apt/archives/libmysqlclient15off_5.0.95-0ubuntu1_i386.deb
/var/cache/apt/archives/libmysqlclient15off_5.0.51a-3ubuntu5.7_i386.deb
/var/cache/apt/archives/libmysqlclient15off_5.0.51a-3ubuntu5.5_i386.deb
/var/cache/apt/archives/libmysqlclient15off_5.0.51a-3ubuntu5.8_i386.deb
/opt/mysql/server-5.5/lib/libmysqlclient_r.a
/opt/mysql/server-5.5/lib/libmysqlclient_r.so.18.0.0
/opt/mysql/server-5.5/lib/libmysqlclient_r.so
/opt/mysql/server-5.5/lib/libmysqlclient.so
/opt/mysql/server-5.5/lib/libmysqlclient_r.so.18
/opt/mysql/server-5.5/lib/libmysqlclient.so.18
/opt/mysql/server-5.5/lib/libmysqlclient.so.18.0.0
/opt/mysql/server-5.5/lib/libmysqlclient.a
/usr/share/doc/libmysqlclient15off
/usr/lib/libmysqlclient.so.15.0.0
/usr/lib/libmysqlclient_r.so.15.0.0
/usr/lib/libmysqlclient.so.15
/usr/lib/libmysqlclient_r.so.15

So, there are some .18 files somewhere ... on the /opt ... area.  Would that be an optical disk in the drive?  Or does that mean something else?  It does appear that MySql 5.5 does want version 18 of the client files.

Suggestions on how to proceed?

Thanks!
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 11

Expert Comment

by:legolasthehansy
ID: 37744626
Your libraries are under /opt and the system is unable to find it.
vi /etc/ld.so.conf
Add /opt/mysql/server-5.5/lib

Save and exit
Run ldconfig again and see if the library is being picked up
0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 37744698
OK, w/ the change I'm about to save, ld.so.conf says
include /etc/ld.so.conf.d/*.conf
include /opt/mysql/server-5.5/lib

Does that look right?  You didn't say "include" but that's what the previous line said.

Thanks!
0
 
LVL 11

Expert Comment

by:legolasthehansy
ID: 37744704
Yes, I meant include
0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 37744769
Thanks for your help ... we're not there yet.

dwilson@williamston:/$ sudo ldconfig
[sudo] password for dwilson:
dwilson@williamston:/$ cd /home/dwilson/c_utilities/
dwilson@williamston:~/c_utilities$ ./CalculatePeaks
./CalculatePeaks: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
dwilson@williamston:~/c_utilities$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
include /opt/mysql/server-5.5/lib

The changed library is showing up in the configuration:
 mysql_config --libs
-L/opt/mysql/server-5.5/lib -lmysqlclient -lpthread -lm -lrt -ldl

I even re-compiled and re-ran the utility ... no change.

What can I try next?

Thanks.
0
 
LVL 11

Expert Comment

by:legolasthehansy
ID: 37745029
Can you try "ldconfig -v | grep libmysqlclient"

Also probably CalculatePeaks is looking for mysqlclient at a standard location?
Try a trace "strace /home/dwilson/c_utilities/CalculatePeaks"
0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 37745060
sudo ldconfig -v | grep libmysqlclient
[sudo] password for dwilson:
/sbin/ldconfig.real: Can't stat /lib64: No such file or directory
/sbin/ldconfig.real: Can't stat /usr/lib64: No such file or directory
        libmysqlclient_r.so.15 -> libmysqlclient_r.so.15.0.0
        libmysqlclient.so.15 -> libmysqlclient.so.15.0.0

Open in new window


So ... that looks like some stuff is invalid.

whoa, strace gave us a lot:
 
strace /home/dwilson/c_utilities/CalculatePeaks
execve("/home/dwilson/c_utilities/CalculatePeaks", ["/home/dwilson/c_utilities/Calcul"...], [/* 18 vars */]) = 0
brk(0)                                  = 0x804a000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a5000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=18928, ...}) = 0
mmap2(NULL, 18928, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb77a0000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/i686/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/i686/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/i686/cmov", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/lib/tls/i686/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/i686", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/lib/tls/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/tls/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/sse2", 0xbffc5f90)     = -1 ENOENT (No such file or directory)
open("/lib/tls/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/cmov", 0xbffc5f90)     = -1 ENOENT (No such file or directory)
open("/lib/tls/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/lib/i686/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i686/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i686/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i686/sse2", 0xbffc5f90)    = -1 ENOENT (No such file or directory)
open("/lib/i686/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i686/cmov", 0xbffc5f90)    = -1 ENOENT (No such file or directory)
open("/lib/i686/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i686", 0xbffc5f90)         = -1 ENOENT (No such file or directory)
open("/lib/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/sse2/cmov", 0xbffc5f90)    = -1 ENOENT (No such file or directory)
open("/lib/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/sse2", 0xbffc5f90)         = -1 ENOENT (No such file or directory)
open("/lib/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/cmov", 0xbffc5f90)         = -1 ENOENT (No such file or directory)
open("/lib/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
open("/usr/lib/tls/i686/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/i686/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/i686/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/i686/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/i686/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/i686/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/i686/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/i686", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls", 0xbffc5f90)      = -1 ENOENT (No such file or directory)
open("/usr/lib/i686/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i686/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i686/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i686/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i686/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i686/cmov", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/i686/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i686", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sse2", 0xbffc5f90)     = -1 ENOENT (No such file or directory)
open("/usr/lib/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/cmov", 0xbffc5f90)     = -1 ENOENT (No such file or directory)
open("/usr/lib/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=20480, ...}) = 0
open("/lib/i486-linux-gnu/tls/i686/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/tls/i686/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/tls/i686/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/tls/i686/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/tls/i686/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/tls/i686/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/tls/i686/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/tls/i686", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/tls/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/tls/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/tls/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/tls/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/tls/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/tls/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/tls/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/tls", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/i686/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/i686/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/i686/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/i686/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/i686/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/i686/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/i686/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/i686", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/lib/i486-linux-gnu/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i486-linux-gnu", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/i486-linux-gnu/tls/i686/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/tls/i686/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/tls/i686/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/tls/i686/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/tls/i686/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/tls/i686/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/tls/i686/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/tls/i686", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/tls/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/tls/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/tls/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/tls/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/tls/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/tls/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/tls/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/tls", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/i686/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/i686/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/i686/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/i686/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/i686/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/i686/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/i686/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/i686", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/sse2/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/sse2/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/sse2/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/sse2", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/cmov/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu/cmov", 0xbffc5f90) = -1 ENOENT (No such file or directory)
open("/usr/lib/i486-linux-gnu/libmysqlclient.so.18", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i486-linux-gnu", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
writev(2, [{"/home/dwilson/c_utilities/Calcul"..., 40}, {": ", 2}, {"error while loading shared libra"..., 36}, {": ", 2}, {"libmysqlclient.so.18", 20}, {": ", 2}, {"cannot open shared object file", 30}, {": ", 2}, {"No such file or directory", 25}, {"\n", 1}], 10/home/dwilson/c_utilities/CalculatePeaks: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
) = 160
exit_group(127)                         = ?
Process 15048 detached

Open in new window

0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 37745071
My c code is very simple.  In fact ... I just tried the example from http://www.cyberciti.biz/tips/linux-unix-connect-mysql-c-api-program.html with the same results.
0
 
LVL 11

Accepted Solution

by:
legolasthehansy earned 500 total points
ID: 37745137
The system still doesn't see your libraries under /opt/. The ldconfig was meant to check whether it was doing that or not.

Let's do it another way.
Open /etc/ld.so.conf
Remove "Include /opt..."
Save and exit

Create a new file under /etc/ld.so.conf.d/ as opt_lib.conf
Add the line "/opt/mysql/server-5.5/lib"
Save and exit
Run "ldconfig -v | grep libmysqlclient"
See if the path shows up. (/opt..)
0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 37745329
Having changed /etc/ld.so.conf and creaetd opt_lib.conf ...

dwilson@williamston:/etc/ld.so.conf.d$ sudo ldconfig -v | grep libmysqlclient
/sbin/ldconfig.real: Can't stat /lib64: No such file or directory
/sbin/ldconfig.real: Can't stat /usr/lib64: No such file or directory
        libmysqlclient.so.18 -> libmysqlclient_r.so.18.0.0
        libmysqlclient_r.so.15 -> libmysqlclient_r.so.15.0.0
        libmysqlclient.so.15 -> libmysqlclient.so.15.0.0

Open in new window


And, trying to run the programs, we get a different error:
dwilson@williamston:~/c_utilities$ ./MySqlTest
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
dwilson@williamston:~/c_utilities$ ./CalculatePeaks
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
dwilson@williamston:~/c_utilities$

Open in new window


I think ... this may be progress!
0
 
LVL 11

Expert Comment

by:legolasthehansy
ID: 37745349
Ok - That's because you don't have Mysql server running, perhaps? Or the mysql server is running but has the socket somewhere else.

ps -ef | grep mysql
0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 37745381
It's definitely running!  My PHP site is still up -- querying the database on nearly every page.

 ps -ef | grep mysql
mysql     4449     1  0 Mar19 ?        00:00:00 /bin/sh /opt/mysql/server-5.5/bin/mysqld_safe
mysql     4909  4449  3 Mar19 ?        01:26:46 /opt/mysql/server-5.5/bin/mysqld --basedir=/opt/mysql/server-5.5 --datadir=/var/lib/mysql --plugin-dir=/opt/mysql/server-5.5/lib/plugin --log-error=/var/lib/mysql/williamston.err --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
dwilson  17953 17001  0 20:23 pts/1    00:00:00 grep mysql
0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 37745389
Ah, what I just posted ... I think ... says the socket is in /var/run/mysqld/mysqld.sock instead of /tmp/mysql.sock.

http://www.tech-recipes.com/rx/762/solve-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock/

Now ... if I can tell my C program to use the right socket ... maybe I'll be in business!
0
 
LVL 32

Author Closing Comment

by:Daniel Wilson
ID: 37745394
You solved the problem I presented.  I'm having another problem ... but I'll treat it as another problem.  Thanks for your help & patience!
0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 37745407
Just had to pay attention to the arguments to mysql_real_connect
http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html

Thanks again!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question