Daily error: Solve the problem that the mysql database installed by the rpm package does not have a mysql_config file, so that zabbix cannot be compiled

When compiling and installing zabbix, because mysql is installed by rpm package, there is no mysql_config file. I found many ways on the Internet, but I still couldn't solve it. Finally, I thought of a solution. Write a blog to share:

# 查看查安装mysql的rpm包,发现没有mysql_devel,故需要安装上去。
[root@localhost ~]# rpm -qa | grep mysql
mysql-community-libs-5.7.19-1.el6.x86_64
mysql-community-client-5.7.19-1.el6.x86_64
mysql-community-common-5.7.19-1.el6.x86_64
mysql-community-server-5.7.19-1.el6.x86_64


# 下载mysql的repo文件的rpm包
# 需要其他版本的可以在这个网站寻找: http://repo.mysql.com/
[root@localhost ~]# wget http://repo.mysql.com/mysql57-community-release-el6.rpm

# 安装mysql的yum源
[root@localhost ~]# rpm -ivh mysql57-community-release-el6.rpm

# 安装好后,会看到多出来两个mysql的yum源
[root@localhost ~]# ll /etc/yum.repos.d
总用量 12
-rw-r--r-- 1 root root 1970 8月  12 11:31 Centos-6.repo
-rw-r--r-- 1 root root 1836 4月  27 2017 mysql-community.repo
-rw-r--r-- 1 root root 1885 4月  27 2017 mysql-community-source.repo

# yum安装mysql_devel,这时就不会报错了
[root@localhost ~]# yum install mysql-devel -y

# 这时候查看mysql的rpm包,就会发现有mysql_devel了。
[root@localhost ~]# rpm -qa | grep mysql
mysql-community-libs-5.7.19-1.el6.x86_64
mysql57-community-release-el6-11.noarch
mysql-community-client-5.7.19-1.el6.x86_64
mysql-community-common-5.7.19-1.el6.x86_64
mysql-community-server-5.7.19-1.el6.x86_64
mysql-community-devel-5.7.31-1.el6.x86_64

# 查看下mysql_config文件是否存在,可以看到已经有了。
[root@localhost src]# ll /usr/bin/mysql_config
-rwxr-xr-x 1 root root 840 6月   2 20:28 /usr/bin/mysql_config

If you use my method and succeed, you can like it. If you are not successful, you can leave a message and discuss together.

Guess you like

Origin blog.csdn.net/weixin_36522099/article/details/107965842