如何解决mysql config 缺失问题


本文摘自PHP中文网,作者藏色散人,侵删。

mysql config缺失的解决办法:首先使用查看mysql的安装情况;然后移除已有的安装包;接着下载64bit的rpm文件;最后重新使用“rpm -ivh MySQL-devel-5.5.16-1.linux...”安装即可。

推荐:《mysql教程》

MySQL缺失mysql_config文件

问题:

工作中需要布置django-sentry日志服务器,在centos-6.4上pip install mysql-python,报错如下

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

[sentry@kjtest111 mysql-python]$ pip install mysql-python

Downloading/unpacking mysql-python

  Running setup.py egg_info for package mysql-python

    sh: /usr/bin/mysql_config: No such file or directory

    Traceback (most recent call last):

      File "<string>", line 16, in <module>

      File "/tmp/pip-build-sentry/mysql-python/setup.py", line 18, in <module>

        metadata, options = get_config()

      File "setup_posix.py", line 43, in get_config

        libs = mysql_config("libs_r")

      File "setup_posix.py", line 25, in mysql_config

        raise EnvironmentError("%s not found" % (mysql_config.path,))

    EnvironmentError: /usr/bin/mysql_config not found

    Complete output from command python setup.py egg_info:

    sh: /usr/bin/mysql_config: No such file or directory

Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/tmp/pip-build-sentry/mysql-python/setup.py", line 18, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 25, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

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

工作环境:centOS6.4

解决方法:

1. 通过报错信息看出是缺少mysql_config,在/usr/bin/下面应该有的mysql_config文件没有,网上的解决方案都是apt-get install libmysqlclient-dev,但是apt-get是Debian、Ubuntu系列的网络安装命令,yum是Redhat、Centos、Fedora是网络安装命令,接着发现Centos上应该安装mysql-devel

2. yum install mysql-devel,发现有冲突,报错如下:

1

2

3

4

5

6

7

8

9

10

11

12

--> Running transaction check

---> Package mysql-devel.x86_64 0:5.1.69-1.el6_4 will be installed

--> Processing Dependency: mysql = 5.1.69-1.el6_4 for package: mysql-devel-5.1.69-1.el6_4.x86_64

--> Running transaction check

---> Package mysql.x86_64 0:5.1.69-1.el6_4 will be installed

--> Processing Conflict: MySQL-client-5.5.30-1.el6.x86_64 conflicts mysql

--> Processing Conflict: MySQL-server-5.5.30-1.el6.x86_64 conflicts mysql

--> Processing Conflict: mysql-5.1.69-1.el6_4.x86_64 conflicts MySQL

--> Finished Dependency Resolution

Error: mysql conflicts with MySQL-devel-5.5.30-1.el6.x86_64

 You could try using --skip-broken to work around the problem

 You could try running: rpm -Va --nofiles --nodigest

3. 使用 rpm -qa|grep mysql查看mysql的安装情况

1

2

3

mysql-devel-5.5.16-1.el6_4.x86_64

mysql-client-5.5.16-1.el6_4.x86_64

mysql-server-5.5.16-1.el6_4.x86_64

4. 使用rpm -e mysql-devel-5.5.16-1.el6_4.x86_64移除已有的安装包

5. 再次使用yum install mysql-devel 发现和mysql-server, mysql-client的版本有冲突

6. 去网上寻找相同的版本下载http://downloads.skysql.com/archive/index/p/mysql/v/5.5.16,下载64bit的rpm文件,使用rpm -ivh MySQL-devel-5.5.16-1.linux2.6.x86_64.rpm安装

7. 安装成功后,去/usr/bin/目录下,发现生成了mysql_config文件,继续pip install mysql-python,顺利完成。

以上就是如何解决mysql config 缺失问题的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

mysql 5.7版本是怎么修改密码的?

navicat for mysql是什么

mysql&nbsp;数据库&nbsp;索引和事务

mysql远程跨库联合查询的示例

mysql运维-lower_case_table_names

mysql索引是什么意思

mysql必知必会:创建高级联结

mysql内存使用的查看方式详解

mysql远程连接如何在阿里云下配置?

mysql怎么查询有哪些用户

更多相关阅读请进入《mysql》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...