Find the location of libmysqlclient.so.X file in Linux environments

Posted 旅途

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Find the location of libmysqlclient.so.X file in Linux environments相关的知识,希望对你有一定的参考价值。

I‘m putting together a script that has a requirement of knowing libmysqlclient.so.[15|16|18] .so file. It‘s usually located in /usr/lib/ , /usr/lib64/ or a mysql/ subdirectory of the aforementioned directories.

 

This will give you all of the libmysql files recognized by the linker. The higher on the list has the higher priority and is more likely to be linked against.

/sbin/ldconfig -p | grep mysql | cut -d\> -f2

One caveat though is that since most applications link by doing a gcc -lmysqlclient they will favor a file in the ldconfig listed as libmysqlclient.so rather than .so.15 or whatever. So personally I would assume that the first libmysqlclient.so is the correct one.

 

Which shared object library is used depends on the user enviroment and binary that is run. If you su - USER to the user that is running the binary and then run the command ldd MYSQLBINARY | grep mysqlclient that will determine which mysqlclient library is going to be used.

By default on most Linux systems, /usr/lib (used for x86 binaries) and /usr/lib64 (used for x86_64 bit binaries).

Btw, running locate libmysqlclient.so to get a list of all the shared objects that are installed system wide (probably won‘t report .so files installed in user paths though).

 

以上是关于Find the location of libmysqlclient.so.X file in Linux environments的主要内容,如果未能解决你的问题,请参考以下文章

错误记录Android Studio 创建报错 ( The length of the module location exceeds the limit of 100 characters. )(代

*Find the Number Occurring Odd Number of Times

find.-name用法

2018-3 video sequence ( find the list of size of the each sub sequence )

location of the android sdk has not been setup in the preferences

634. Find the Derangement of An Array