Configuring Django to use a remote mysql server?

I am trying to configure a Django application to use mysql.

I want to use the mysql server available on my network and do not want to install a local copy.

But when I try to install mysqldb, it needs mysql_config from Mysql!

What if i want to use mysql server on another computer?

sh: mysql_config: command not found Traceback (most recent call last): File "setup.py", line 15, in <module> metadata, options = get_config() File "~/Dev/MySQL-python-1.2.3c1/setup_posix.py", line 43, in get_config libs = mysql_config("libs_r") File "~/Dev/MySQL-python-1.2.3c1/setup_posix.py", line 24, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found 

Tried loading MySQL files and pointed to "mysql_config" and built mysqldb.

But when I tried to import mysqldb, I get:

 >>> import MySQLdb Traceback (most recent call last): File "<stdin>", line 1, in <module> File "build/bdist.macosx-10.5-i386/egg/MySQLdb/__init__.py", line 19, in <module> File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in <module> File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in __bootstrap__ ImportError: dlopen(/tmp/MySQL_python-1.2.3c1-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so, 2): Library not loaded: /usr/local/mysql/lib/libmysqlclient_r.15.dylib Referenced from: /tmp/MySQL_python-1.2.3c1-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so Reason: image not found 

Any hint that a mistake?

thanks

+3
django mysql configuration
source share
3 answers

I finally got MySQLdb compiled without installing a MySQL server in my MacOSX.

Stages:

  • Download the appropriate MySQL package (tar), do not install the version and unzip
  • Download MySQLdb wrapper from MySQL Python binding
  • Unzip MySQLdb
  • Modify site.cfg to point to mysql_config in the directory you downloaded.
  • Follow the instructions in MySQLdb (essentially create and install)
  • Copy the libmysqlclient_r.15.dylib file from your "mysql / lib" folder to / usr / local / mysql / lib (assuming you selected the streaming version)
  • You are now ready to use MySQLdb with any MySQL server.
  • You can test the installation using: python -> import MySQLdb
+3
source share

You need to install mysql client libraries on a machine running Django so that it can connect to a remote MySQL server. Both simple libmysqlclient and python mysql driver. Additional information depends on the platform on which you are running this.

+2
source share

Install the precompiled version of the MySQLdb driver. Most Linux distributions provide it in their repositories - for example, in Debian and Ubuntu it is called python-mysqldb .

In addition, since it is not related to programming, it is best to move it to superuser.

+1
source share

All Articles