?
Solved

mysql - missing libmysqlclient.so.18

Posted on 2012-03-20
17
Medium Priority
?
6,722 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

800 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