Skip to content

Commit

Permalink
Fixed #26868 -- Changed MySQL version detection to use a query.
Browse files Browse the repository at this point in the history
Workaround a bug with MariaDB and MySQL native client not stripping the
`5.5.5-` prefix.
  • Loading branch information
marcaurele authored and timgraham committed Jul 15, 2016
1 parent 92c48a3 commit f8bfa80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -464,6 +464,7 @@ answer newbie questions, and generally made Django that much better:
Marcin Wróbel
Marc Remolt <m.remolt@webmasters.de>
Marc Tamlyn <marc.tamlyn@gmail.com>
Marc-Aurèle Brothier <ma.brothier@gmail.com>
Marian Andre <django@andre.sk>
Marijn Vriens <marijn@metronomo.cl>
Mario Gonzalez <gonzalemario@gmail.com>
Expand Down
5 changes: 3 additions & 2 deletions django/db/backends/mysql/base.py
Expand Up @@ -369,8 +369,9 @@ def is_usable(self):

@cached_property
def mysql_version(self):
with self.temporary_connection():
server_info = self.connection.get_server_info()
with self.temporary_connection() as cursor:
cursor.execute('SELECT VERSION()')
server_info = cursor.fetchone()[0]
match = server_version_re.match(server_info)
if not match:
raise Exception('Unable to determine MySQL version from version string %r' % server_info)
Expand Down

0 comments on commit f8bfa80

Please sign in to comment.