mysql_config not found when installing mysqldb python interface

前端 未结 30 1809
暗喜
暗喜 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:30

    mySQLdb is a python interface for mysql, but it is not mysql itself. And apparently mySQLdb needs the command 'mysql_config', so you need to install that first.

    Can you confirm that you did or did not install mysql itself, by running "mysql" from the shell? That should give you a response other than "mysql: command not found".

    Which linux distribution are you using? Mysql is pre-packaged for most linux distributions. For example, for debian / ubuntu, installing mysql is as easy as

    sudo apt-get install mysql-server
    

    mysql-config is in a different package, which can be installed from (again, assuming debian / ubuntu):

    sudo apt-get install libmysqlclient-dev
    

    if you are using mariadb, the drop in replacement for mysql, then run

    sudo apt-get install libmariadbclient-dev
    

    Reference: https://github.com/JudgeGirl/Judge-sender/issues/4#issuecomment-186542797

提交回复
热议问题