Why dynamic link library cannot be found during Linux program running
If the directory of the dynamic link library required by the program is not added to the environment variable LD_LIBRARY_PATH, an error will occur when running the program.
The following error occurs when executing the InitMySQLv1 program:
#./InitMySQLv1
./InitMySQLv1: error while loading shared libraries: libmysqlclient. so.18: cannot open shared object file: No such file or directory
[Solution]
Run the find command to find the directory in which libmysqlclient. so.18 is located:
# Find/-name "libmysqlclient. so.18"
/U01/app/mysql/lib/libmysqlclient. so.18
Go to the user's Home directory, open the. bash_profile file, and add libmysqlclient. so.18 to the environment variable LD_LIBRARY_PATH.
# Cd ~ // Enter the user's Home directory
# Vi. bash_profile // open the. bash_profile file with v I
If you want to edit the. bash_profile file and save it:
Then the user logs in again and runs the InitMySQLv1 program. There is no error.
Solve the problem!
This article permanently updates the link address: