Why does django use mysqldb over mysql-connector?

3,111 views
Skip to first unread message

john2095

unread,
May 3, 2012, 9:18:23 PM5/3/12
to django...@googlegroups.com
I've just been through a slice of hell simply because I did not want to install mysql-server on my (osx) django development machine - my app connects to a remote mysql database.  It turns out that python's "mysqldb" depends on mysql binaries which are only packaged up with the server release.  This means that if you want to run django and connect to a remote mysql you still need to install mysqlserver locally.  I think that blows. Especially when there is a purely python mysql driver in "mysql-connector".

Has this happened by default or by design?  Is mysqldb really that much faster, or featureful, or just because it's more common?

Is anyone working on a pure python solution (mysql-connector) database backend? Is there one already?

thanks.

Steve McConville

unread,
May 3, 2012, 9:30:31 PM5/3/12
to django...@googlegroups.com
> Has this happened by default or by design?  Is mysqldb really that much
> faster, or featureful, or just because it's more common?

From http://forge.mysql.com/projects/project.php?id=302

"Development Status: Early (Pre-Alpha)"

--
steve

john2095

unread,
May 4, 2012, 1:21:57 AM5/4/12
to django...@googlegroups.com
Yes, that's the pure python adapter I'm talking about.  I think that's effectively the same as this one.  Nice link but I'm not sure if you're suggesting that as additional information or an answer?

The question remains is a compelling reason why "django.db.backends.mysql" is built upon mysqldb with dependencies rather one without dependancies, and if anyone has attempted to implement an equivalent "django.db.backends.mysql" with the latter.

Kurtis Mullins

unread,
May 4, 2012, 2:53:43 AM5/4/12
to django...@googlegroups.com
I think what he was trying to get at is that the Python MySQL Adapter is in early stages of development where-as Django is depended upon to be a very stable platform/framework. It would be great to have the option to use that adapter though for situations like yours.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/xLS_rF0bi_gJ.

To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

john2095

unread,
May 4, 2012, 3:36:44 AM5/4/12
to django...@googlegroups.com
Oh. Thanks Kurtis. That answers the first question: it's built on mysqldb primarily because it's mature and stable. Thanks.

As for the second question: has anyone tried building a backend on mysql-connector yet?  Silence?  Is this an opportunity?

Masklinn

unread,
May 4, 2012, 3:47:47 AM5/4/12
to django...@googlegroups.com

On 2012-05-04, at 09:36 , john2095 wrote:

> Oh. Thanks Kurtis. That answers the first question: it's built on mysqldb
> primarily because it's mature and stable. Thanks.
>
> As for the second question: has anyone tried building a backend on
> mysql-connector yet? Silence? Is this an opportunity?

A quick google search (still works), points to
https://github.com/rtyler/connector-django-mysql and a few of its forks
(e.g. https://github.com/jerith/connector-django-mysql), as well as a
workaround like
http://forums.mysql.com/read.php?50,400033,400320#msg-400320

So yes, it would seem people have tried building backends, and these
works look mostly abandoned at this point.

Ramiro Morales

unread,
May 4, 2012, 5:13:20 AM5/4/12
to django...@googlegroups.com
On Thu, May 3, 2012 at 10:18 PM, john2095 <joh...@gmail.com> wrote:
> I've just been through a slice of hell simply because I did not want to
> install mysql-server on my (osx) django development machine - my app
> connects to a remote mysql database.  It turns out that python's "mysqldb"
> depends on mysql binaries which are only packaged up with the server
> release.  This means that if you want to run django and connect to a remote
> mysql you still need to install mysqlserver locally.  I think that
> blows. Especially when there is a purely python mysql driver in
> "mysql-connector".
>
> Has this happened by default or by design?  Is mysqldb really that much
> faster, or featureful, or just because it's more common?

IMHO who you really need to ask and whine to is with the providers of the
packaging of mysqldb and MySQL in your platform. It is really nasty that in
2012 you need to install the binaries of a database server to be able
to install the client-side drivers of a programming language. This is a
problem solved decades ago.

--
Ramiro Morales

Tom Evans

unread,
May 4, 2012, 5:46:35 AM5/4/12
to django...@googlegroups.com
MySQL's client libraries provide a reference C API to access the
database, and are the basis for most MySQL drivers. These are
obviously bundled as part of the server code, but can be built
separately.

The vast majority of OS will package the client libraries separately
to the server binaries - eg Debian:
http://packages.debian.org/sid/mysql-client-5.1 - but I expect you
installed from source, and were put off by it downloading the full
MySQL source tarball.

Cheers

Tom

john2095

unread,
May 4, 2012, 9:30:25 PM5/4/12
to django...@googlegroups.com
My frustration was borne by the ease with which Debian makes the task: I did expect the job to be an insignificant one-line command. Thanks Tom. Apple don't see a profit in providing a mysql-client package.  Ramiro has a point that lobbying MySQL for a client-only OSX package is a righteous path. Thanks Ramiro.

But at the end of the day we can't expect everyone else to do everything for us.  I'm now dreaming of a week or two with nothing to do but put time into one of those abandoned starts at a django-mysql-connector.  Thanks Masklinn.

I think you've all answered my questions.

1) It's happened by design; mysqldb is mature, stable and omnipotent; mysql/oracle and apple are unmotivated.
2) No-one is currently working on removing the dependency.  There are only a couple of false starts to date.

cheers,
John.

lza...@ucs.br

unread,
Nov 3, 2014, 8:57:34 PM11/3/14
to django...@googlegroups.com

Hi all,

I notice that python-mysql-connector(1) is almost 30% slow that MySQLdb(2), but MySQLdb until now not support python3.

Anyone have news when MySQLdb will support python 3 or know another connector for mysql?

It's a litte confused at this time, because we have django1.7.X that supports python3.4.X very well, but we don't have a good compatible mysql connector.

1-http://dev.mysql.com/downloads/connector/python/
2-https://pypi.python.org/pypi/MySQL-python/1.2.5

Enviado via UCSMail.

Larry Martell

unread,
Nov 4, 2014, 6:08:38 AM11/4/14
to django...@googlegroups.com
What about mysqlclient? The django site says that is "the recommended
choice for using MySQL with Django" but I can't seem to find that
package. Does anyone have a link for that?
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/041bea14-74e6-42ce-b549-8ca5d31344e4%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

lza...@ucs.br

unread,
Nov 4, 2014, 6:59:11 AM11/4/14
to django...@googlegroups.com

Are you talking about this?

https://github.com/PyMySQL/mysqlclient-python

I didn't tried that. Someone use it?

Enviado via UCSMail.

Larry Martell

unread,
Nov 4, 2014, 7:02:50 AM11/4/14
to django...@googlegroups.com
Yes, thanks for the link. For some reason google wasn't finding that for me.

Collin Anderson

unread,
Nov 5, 2014, 12:29:29 PM11/5/14
to django...@googlegroups.com
Hello,
 
https://github.com/PyMySQL/mysqlclient-python

I didn't tried that. Someone use it?

I use it.

There's a thread about it on django-developers.

Collin
 
Reply all
Reply to author
Forward
0 new messages