查看mysql.h和libmysqlclient.so的路径
eik@eik-Virtual-Machine:~/桌面/dbpool/bin$ locate mysql.h
/usr/include/mysql/mysql.h
eik@eik-Virtual-Machine:~/桌面/dbpool/bin$ locate libmysqlclient.so
/usr/lib/x86_64-linux-gnu/libmysqlclient.so
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.2.35
如果找不到,则安装
sudo apt-get update
apt-cache search libmysql
sudo apt-get install libmysqlclient-dev libmysql++-dev
添加到CMakeLists.txt中
include_directories(/usr/include/mysql)
link_directories(/usr/lib/x86_64-linux-gnu)
target_link_libraries(xxx libmysqlclient.so)