详解生产环境如何安装mysql.h来调用mysql数据库
概述
最近在生产环境安装sysbench工具,由于之前是rpm安装的mysql,编译的时候发现了mysql.h缺失的问题,这个问题也属于很多共性的问题,这里就顺便做个总结。
1、具体报错
sysbench在make的时候提示fatal error: mysql.h不存在,报错如下:

可以看到红色字体部分--fatal error:mysql.h no such file or directory
2、查看是否安装mysql.h
可以看到mysql.h在系统中是不存在的

3、安装mysql.h
既然没有mysql.h,那么直接安装就可以了
ps:这个rpm包官网下载对应版本就可以了
# rpm -ivh mysql-community-devel-5.7.26-1.el7.x86_64.rpm --rpm包查找mysql的bin include lib # find / -name mysql.h -print # find / -name libmysqlclient.so -print # find / -name mysql -print

4、重新make测试

成功make,问题解决。