0

I'm trying to use MySQL with django and right now the following isn't executing properly:

python manage.py syncdb

I also downloaded the Mysql-python interpreter and ran the following lines but still an error:

python setup.py build
sudo python setup.py install


Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "/Users/user/Downloads/MySQL-python-1.2.3/setup_posix.py", line 49, in get_config
    libs = mysql_config("libs")
  File "/Users/user/Downloads/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: /usr/local/bin/mysql_config not found

I think it's having trouble finding mysql_config, is there a way that I can point the setup to the file? Right now my setup.py is in ~/Downloads and mysql is in /usr/local/mysql/bin

locoboy
  • 38,002
  • 70
  • 184
  • 260
  • 1
    So... does `/usr/local/bin/mysql_config` exist? If not, you need to tell it where `mysql_config` is. – agf Aug 02 '11 at 19:30
  • no it doesn't exist, but I don't know where to find it or tell the system where to find it. – locoboy Aug 02 '11 at 20:04
  • Please clarify what operating system you are running on and what version of Python you are trying to use. Otherwise, we will just be guessing at how to help. – Ned Deily Aug 02 '11 at 20:20

3 Answers3

2

It seems you may not have any of the MySQL client applications installed. If you are using Linux (and this varies from distribution to distribution), the package you will need to install on Ubuntu is "mysql-client".

nesv
  • 786
  • 6
  • 10
  • 1
    the MySQL headers will be also required to compile the module, the package name should be `mysql-dev` or something similar. – mdeous Aug 02 '11 at 20:14
1

From the path you show, I'm guessing you are running on Mac OS X (you really need to state what platform you are using and what version of Python you are running). However, if you are on Mac OS X, your best bet by far is to use a complete solution of installing compatible versions of Python, MySQL client libraries, MySQLdb, and Django by using one of the third-party open source package managers on OS X: MacPorts, homebrew, Fink, or others.

See, for example, the answer here.

Community
  • 1
  • 1
Ned Deily
  • 83,389
  • 16
  • 128
  • 151
  • I am using all the right versions, but I think the main issue is that my install of mysql-python can't find the mysql_config file. Does this have something to do with where I'm running the build script? Right now the mysql-python folder is in ~/Downloads and mysql_config is in /usr/local/mysql/bin/ – locoboy Aug 05 '11 at 08:10
0

The answer was to edit the site.cfg file so that it points to the mysql_config file in the /usr/local/mysql dir

locoboy
  • 38,002
  • 70
  • 184
  • 260