Failed to install MySQLdb for the second version of Python

Context: I am working on some Python scripts on an Ubuntu server. I need to use code written in Python 2.7, but our server has Python 2.5. We installed 2.7 as the second instance of Python, so that we don't break anything that depends on 2.5. Now I need to install the MySQLdb package. I assume that I cannot do this in a simple way by running apt-get install python-mysqldbbecause it will most likely just reinstall on python 2.5, so I am just trying to install it manually.

Problem: in the MySQL-python-1.2.3 directory, I'm trying to start python2.7 setup.py buildand get an error message:

sh: /etc/mysql/my.cnf: denied denied

along with Traceback, which says setup.py could not find the file.

Note that the setup.py script by default looks for the file mysql_configin the $ PATH directories, but the mysql configuration file for our server /etc/mysql/my.cnf, so I changed the package file site.cfgto match. I checked the permissions for the file, which are -rw-rr--. I tried to run the script as root and got the same error.

Any suggestions?

+3
source share
2 answers

To my knowledge, there is a very significant difference between mysql_config and my.cnf.

  • mysql_config is usually located in the bin folder of your MySQL installation and, when executed, spits out information about your file system about your installation.

  • "my.cnf" - script, MySQL.

, script "mysql_config" , , "mysql_config" , , . MYSQLdb mysql_config, , . . MySQL .

, , :

  • .

  • , , "mysql_config" .

"bin" MySQL , "mysql_config" . "site.cnf", .

+2

, - ? $PATH ?

script - ? script su sudo, ? , script root?

, . chroot virtualenv?

0

Source: https://habr.com/ru/post/1773943/


All Articles