mysql_config not found when installing mysqldb python interface

前端 未结 30 1431
暗喜
暗喜 2020-11-22 06:56

I am trying to get a Python script to run on the linux server I\'m connected to via ssh. The script uses mysqldb. I have all the other components I need, but when I try to i

相关标签:
30条回答
  • 2020-11-22 07:21

    The package libmysqlclient-dev is deprecated, so use the below command to fix it.

    Package libmysqlclient-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

    sudo apt-get install default-libmysqlclient-dev
    
    0 讨论(0)
  • 2020-11-22 07:21

    I fixed it by installing libmysqlclient:

    sudo apt-get install libmysqlclient16-dev
    
    0 讨论(0)
  • 2020-11-22 07:22

    I had this issues and solved if by adding a symlink to mysql_config.

    I had installed mysql with homebrew and saw this in the output.

    Error: The `brew link` step did not complete successfully
    

    Depending on how you got mysql it will be in different places. In my case /usr/local/Cellar/mysql
    Once you know where it is you should be able to ma a symbolic link to where python is looking for it. /usr/local/mysql

    This worked for me.

    ln -s /usr/local/Cellar/mysql/<< VERSION >>/bin/mysql_config   /usr/local/mysql/bin/mysql_config
    
    0 讨论(0)
  • 2020-11-22 07:22

    In CentOS 7 , the following things should be done:

    #step1:install mysql 
    https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
    
    #step2:
    sudo yum install mysql-devel
    

    or

    sudo yum install mysql-community-devel
    
    0 讨论(0)
  • 2020-11-22 07:22

    sudo apt-get install python-mysqldb

    Python 2.5? Sounds like you are using a very old version of Ubuntu Server (Hardy 8.04?) - please confirm which Linux version the server uses.

    python-mysql search on ubuntu package database

    Some additional info:

    From the README of mysql-python -

    Red Hat Linux .............

    MySQL-python is pre-packaged in Red Hat Linux 7.x and newer. This includes Fedora Core and Red Hat Enterprise Linux. You can also build your own RPM packages as described above.

    Debian GNU/Linux ................

    Packaged as python-mysqldb_::

    # apt-get install python-mysqldb
    

    Or use Synaptic.

    .. _python-mysqldb: http://packages.debian.org/python-mysqldb

    Ubuntu ......

    Same as with Debian.

    Footnote: If you really are using a server distribution older than Ubuntu 10.04 then you are out of official support, and should upgrade sooner rather than later.

    0 讨论(0)
  • 2020-11-22 07:23

    The commands (mysql too) mPATH might be missing.

    export PATH=$PATH:/usr/local/mysql/bin/

    0 讨论(0)
提交回复
热议问题