fatal error: mysql.h: No such file or directory

 #include <mysql.h>

                   ^

compilation terminated.


如下,安装缺少的包文件:

yum install mysql-devel


Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

Resolving Dependencies

--> Running transaction check

---> Package mariadb-devel.x86_64 1:5.5.60-1.el7_5 will be installed

--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.60-1.el7_5 for package: 1:mariadb-devel-5.5.60-1.el7_5.x86_64

--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 1:mariadb-devel-5.5.60-1.el7_5.x86_64

--> Running transaction check

---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


================================================================================

 Package              Arch          Version                   Repository   Size

================================================================================

Installing:

 mariadb-devel        x86_64        1:5.5.60-1.el7_5          base        754 k

Installing for dependencies:

 mariadb-libs         x86_64        1:5.5.60-1.el7_5          base        758 k


Transaction Summary

================================================================================

Install  1 Package (+1 Dependent package)


Total download size: 1.5 M

Installed size: 7.7 M

Is this ok [y/d/N]: y

Downloading packages:

(1/2): mariadb-devel-5.5.60-1.el7_5.x86_64.rpm             | 754 kB   00:00     

(2/2): mariadb-libs-5.5.60-1.el7_5.x86_64.rpm              | 758 kB   00:00     

--------------------------------------------------------------------------------

Total                                               11 MB/s | 1.5 MB  00:00     

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning: RPMDB altered outside of yum.

** Found 4 pre-existing rpmdb problem(s), 'yum check' output follows:

perl-DBD-MySQL-4.023-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)

perl-DBD-MySQL-4.023-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)

2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)

2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)

  Installing : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                         1/2 

warning: /etc/my.cnf created as /etc/my.cnf.rpmnew

/sbin/ldconfig: /lib64/liblog4cxx.so.10 is not a symbolic link


  Installing : 1:mariadb-devel-5.5.60-1.el7_5.x86_64                        2/2 

  Verifying  : 1:mariadb-devel-5.5.60-1.el7_5.x86_64                        1/2 

  Verifying  : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                         2/2 


Installed:

  mariadb-devel.x86_64 1:5.5.60-1.el7_5                                         


Dependency Installed:

  mariadb-libs.x86_64 1:5.5.60-1.el7_5                                          


Complete!