首頁 >資料庫 >mysql教程 >如何解決mysql config 缺失問題

如何解決mysql config 缺失問題

藏色散人
藏色散人原創
2020-10-08 18:14:263223瀏覽

mysql config缺少的解決方法:先使用查看mysql的安裝情況;然後移除現有的安裝包;接著下載64bit的rpm檔;最後重新使用「rpm -ivh MySQL-devel-5.5. 16-1.linux...”安裝即可。

如何解決mysql config 缺失問題

推薦:《mysql教學

MySQL缺少mysql_config檔

問題:

工作中需要佈置django-sentry日誌伺服器,在centos-6.4上pip install mysql-python,報錯如下

[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,發現衝突,錯誤如下:

--> 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的安裝狀況

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 缺失問題的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn