简体   繁体   中英

Lazarus console app can't connect to mysql - ubuntu

I have one console app in Lazarus and my OS is Ubuntu 16.04. I can connect to db in Lazarus IDE. But when I try to connect to database in my console app my exeption is :

Can not load default MySQL library ("libmysqlclient.so.18" or "libmysqlclient.so"). Check your installation.

Why I can't connect in console app but in IDE I can ? How can I solve this problem?

First add:

{$LinkLib libmysqlclient.so} 

and find the mysql or mariadb version client lib and copy to folder project or /usr/libs/libmysqlclient.so.xx xx is version

I'm Add :

{$LinkLib libmysqlclient.so}    

after uses then :

copy libmysqlclient.so by this name /usr/lib/libmysqlclient.so.18 .

It's done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM