Questions about MySQL notes in Django docs

62 views
Skip to first unread message

Carsten Fuchs

unread,
Jan 23, 2019, 5:10:18 AM1/23/19
to Django users
Dear Django group,

can you please help me with some questions about
https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-notes ?
(I've been using Django with an Oracle database for years, but I'm new
to MySQL.)

a) Does "Django supports MySQL 5.6 and higher." cover MySQL 8? (I'm not
sure about the status of some tickets and PRs.)

b) Why is the "mysqlclient" client the recommended choice?

c) Using MySQL 8 and considering
https://code.djangoproject.com/ticket/18392, should we set utf8 or
utf8mb4 as the character set?
https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-sets.html
indicates that utf8 is an alias to the deprecated utf8mb3 even with MySQL 8.

d) Why is isolation level "read committed" preferred over "repeatable
read"? The text says "Data loss is possible with repeatable read.", but
how can "repeatable read" have data loss that "read committed" has not?

Thank you!

Best regards,
Carsten

Michal Petrucha

unread,
Jan 23, 2019, 7:57:27 AM1/23/19
to Django users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
I can't answer the rest of your questions, but here's a discussion
that might shed some light on this for you (along with the tickets
linked from that thread):
https://groups.google.com/d/msgid/django-developers/1c8af1c8-23dd-4c79-85ce-9486290ae73f%40googlegroups.com

Michal
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCgAGBQJcSGR9AAoJEHA7T/IPM/klu9QP/A2hCcibyiFvKBVD2mGOl8Wm
373BMpdq07p5UW3LJHY/sxBy343UuhKqc8/tl7MYGk0l1VsdnIBDEO73AMQPDKE2
LSWdQa5vNWwQR6RR2HdyAmJRDCCCp79eJmLZ8NTBWFCrYYB+u8Oi8dw3dm7zWeRu
PiYaub0+f5WonwREt9x/Ezt5ztI30t65MCqOSTaZOnA2pKmdDYEshRorIdPLtrjA
9k2Uh8XJe/LnKStQy7Vj/L5OJDKGXP3L/GSj1r04ZDrIF9rjOcJMZrcoFBYKHewM
ofC0SVtYvsKx2wcngePAPIthkL0czi05tOeZD1qMRuaLuxQ3zHpr3LFIgfsFn80C
tDjpS6/P8iwi+XWbIFtu2U90mzr1e5feIfgkd2bXxpZEUjdG+GaypJ+T0DEsozu+
ydrupUO4uOOhtQk0DawVkcz4ElM1fibfXFI4XS88c/Ykf9Ptoeib1fXqHxnMjXEf
bpkrqhZEHlnMUx1ftDy2FYE6Jqx9QT7diEaUbQPpggb+7MeJfMDHCiZlgwGijboy
8SUY31/0+lzgQ4v1NlaBU90lEVp8vehLI7qHpJhtPgBzfRxtANEX+O3ghoXlqv5d
Tqyuh0caL6sOOyZPiEhRhGWLvKTA9LmDhbAgJH2gABYnG+8BJZ6yYBHE89LXN4rd
NOYJAcID+ZrMC/wgudjc
=l01c
-----END PGP SIGNATURE-----

RETAIL CYBER

unread,
Jan 23, 2019, 8:08:34 AM1/23/19
to django...@googlegroups.com
i cant even get it to load


--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7d5c0f45-95eb-461b-ace5-3a823aacd2c7%40cafu.de.
For more options, visit https://groups.google.com/d/optout.

Tim Graham

unread,
Jan 23, 2019, 10:37:09 AM1/23/19
to Django users
Yes, Django supports MySQL 8. If you google "django mysql 8" the second result is https://code.djangoproject.com/ticket/29451. Based on the commits there, it looks like Django 2.0.7 and above received the fixes.

Carsten Fuchs

unread,
Jan 23, 2019, 5:26:41 PM1/23/19
to django...@googlegroups.com
Hi Tim,

thanks for your reply!

I'm sorry if I left the impression that I had not spent any time with research before posting my question!

Unfortunately and mistakenly, I was referring to the 2.1 docs when I am in fact still using Django 1.11:
My problem is that I still (have to) use an Oracle 11 database, which in turn gets me stuck with Django 1.11 LTS – this is one of the reasons for our planned switch to MySQL (unfortunately I was not able to persuade the team to use PostgreSQL instead).

Therefore, I have to switch from Oracle 11 to MySQL at Django 1.11.

Thus my question: With #29451 referring to Django 2.0, does the MySQL support in Django 1.11 cover MySQL 8, so that I can from there upgrade to newer Django versions?

Sorry again for having not made that clear in my initial message!

Best regards,
Carsten



Am 23.01.19 um 16:37 schrieb Tim Graham:
> Yes, Django supports MySQL 8. If you google "django mysql 8" the second result is https://code.djangoproject.com/ticket/29451. Based on the commits there, it looks like Django 2.0.7 and above received the fixes.
>
> On Wednesday, January 23, 2019 at 5:10:18 AM UTC-5, Carsten Fuchs wrote:
>
> Dear Django group,
>
> can you please help me with some questions about
> https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-notes <https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-notes> ?
> (I've been using Django with an Oracle database for years, but I'm new
> to MySQL.)
>
> a) Does "Django supports MySQL 5.6 and higher." cover MySQL 8? (I'm not
> sure about the status of some tickets and PRs.)
>
> b) Why is the "mysqlclient" client the recommended choice?
>
> c) Using MySQL 8 and considering
> https://code.djangoproject.com/ticket/18392 <https://code.djangoproject.com/ticket/18392>, should we set utf8 or
> utf8mb4 as the character set?
> https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-sets.html <https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-sets.html>

Carsten Fuchs

unread,
Jan 24, 2019, 5:28:57 AM1/24/19
to django...@googlegroups.com
Hi Michael,

Am 23.01.19 um 13:56 schrieb Michal Petrucha:
>> d) Why is isolation level "read committed" preferred over "repeatable read"?
>> The text says "Data loss is possible with repeatable read.", but how can
>> "repeatable read" have data loss that "read committed" has not?
>
> I can't answer the rest of your questions, but here's a discussion
> that might shed some light on this for you (along with the tickets
> linked from that thread):
> https://groups.google.com/d/msgid/django-developers/1c8af1c8-23dd-4c79-85ce-9486290ae73f%40googlegroups.com

Wow, that's very informative!

Jason

unread,
Jan 24, 2019, 8:47:37 AM1/24/19
to Django users
It doesn't look like the fixes were backported to 1.11, after looking in the django 1.11 release notes.  As Tim said, 

Based on the commits there, it looks like Django 2.0.7 and above received the fixes

What I would suggest you do with this is start a django 2.0 project project with the latest 2.0.x version and mysql 8.  Work to port your project from 1.11 to 2.0 and get all the tests working, then increment your django version to the latest 2.1.x release.

Be aware that the next coming LTS, 2.2, is currently in alpha testing release with an anticipated release in April this year.  So, it could be very likely this approach requires you to do 3 django updates in close intervals, but I believe the big question for you is whether your 1.11 project is entirely on python 3, as the 2.x version dropped support for python 2. 

RETAIL CYBER

unread,
Jan 24, 2019, 1:00:10 PM1/24/19
to django...@googlegroups.com
Now I'm stuck on it saying phpmyadmin not working 

--
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 https://groups.google.com/group/django-users.

Jason

unread,
Jan 24, 2019, 2:15:30 PM1/24/19
to Django users
please stick to one topic per issue, and not keep spamming random topics.  

Kasper Laudrup

unread,
Jan 24, 2019, 2:24:18 PM1/24/19
to django...@googlegroups.com
Hi RETAIL CYBER

On 24/01/2019 18.59, RETAIL CYBER wrote:
> Now I'm stuck on it saying phpmyadmin not working
>


Have you tried turning it off and on again?

(Sorry, couldn't help it)

/Kasper

Carsten Fuchs

unread,
Jan 26, 2019, 5:20:04 AM1/26/19
to django...@googlegroups.com
Hi Jason,

Am 24.01.19 um 14:47 schrieb Jason:
> It doesn't look like the fixes were backported to 1.11, after looking in the django 1.11 release notes.
> As Tim said, 
>> Based on the commits there, it looks like Django 2.0.7 and above received the fixes

Yes, that's part of my problem.

My project is already at Python 3.6 and normally I would now work through Django versions 2.0, 2.1 and soon 2.2, upgrading and testing at each iteration.

Unfortunately, Django 2.0 does no longer support Oracle 11 while Django 1.11 doesn't have the MySQL fixes referenced by Tim.

That means that I'd be forced to switch from Django 1.11 to Django 2.0 and from Oracle 11 to MySQL 8 simultaneously – and that is more risk that I can bear. (Being able to follow Django's point releases at a reasonable pace is my main personal motivation for switching the database. Being stuck is really frustrating.)

Thus, the first step that I have to take is to switch the database to MySQL 8 at Django 1.11.
Thus my question: ticket #29451 doesn't seem to affect my use case, but is there anything else that I should be aware of when using MySQL 8 at Django 1.11?

For example, web search leads to https://stackoverflow.com/questions/49949480/test-django-with-mysql-8-0-datetime-incompatible
However, I'm not experienced enough with MySQL 8 to draw the proper conclusions: Will Django 1.11 work anyways with the latest connector? https://bugs.mysql.com/bug.php?id=90541 suggests a work-around (for Django 2.0), but does the datetime problem affect the recommended "mysqlclient" connector as well?

Which brings me back to my other questions:

b) Why is the "mysqlclient" client the recommended choice? --- quite the opposite is suggested at https://dev.mysql.com/doc/connector-python/en/

c) Regarding utf8, utf8mb3 and utf8mb4 there is conflicting information as well (https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-sets.html), but I can figure that out on my own.

Best regards,
Carsten
Reply all
Reply to author
Forward
0 new messages