|
我试着编了一个简单的mysql连接程序:
#include <mysql.h>
#define NULL 0
int main(void)
{
MYSQL *mysql=0;
if (!(mysql= mysql_init(NULL)))
{
/*myerror("mysql_init() failed");*/
exit(1);
}
if (!(mysql_real_connect(mysql,"cu0601","root","123456","grid",0,NULL,0)))
{
/*myerror("connection failed");*/
mysql_close(mysql);
exit(1);
}
printf("Connect successful!");
mysql_close(mysql);
}
编译顺利通过:
gcc -o mysqlcon mysqlcon.c -I/usr/local/mysql/include/mysql -L/usr/local/mysql/lib/mysql -lmysqlclient
可执行./mysqlcon却出错:
./mysqlcon: error while loading shared libraries: libmysqlclient.so.14: cannot open shared object file: No such file or directory
请问一下是什么原因? |
|