代码:http://download.csdn.net/detail/chuanyu/9674720
一开始真是各种坑
安装了MysqL-server , MysqL-client,MysqL-devel
[root@localhost MysqL0322]# g++ -I /usr/include/MysqL -L /usr/lib/MysqL main.cpp mydb.cpp -o main -lMysqLclient
[root@localhost MysqL0322]# ls
main main.cppmydb.cpp mydb.h
[root@localhost MysqL0322]# ./main
MysqL_real_connect: Success
[root@localhost MysqL0322]#
原文链接:https://www.f2er.com/centos/380041.html