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

Source: Internet
Author: User

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 would give you all of the Libmysql files recognized by the linker. The higher on the list have the higher priority and are more likely to be linked against.

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

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

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

By default in 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 GKFX objects that is 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.