diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
|
a
|
b
|
|
| 407 | 407 | |
| 408 | 408 | def get_server_version(self): |
| 409 | 409 | if not self.server_version: |
| | 410 | new_connection = False |
| 410 | 411 | if not self._valid_connection(): |
| 411 | | self.cursor() |
| 412 | | m = server_version_re.match(self.connection.get_server_info()) |
| | 412 | # Ensure we have a connection with the DB by using a temporary |
| | 413 | # cursor |
| | 414 | new_connection = True |
| | 415 | self.cursor().close() |
| | 416 | server_info = self.connection.get_server_info() |
| | 417 | if new_connection: |
| | 418 | # Make sure we close the connection |
| | 419 | self.connection.close() |
| | 420 | self.connection = None |
| | 421 | m = server_version_re.match(server_info) |
| 413 | 422 | if not m: |
| 414 | | raise Exception('Unable to determine MySQL version from version string %r' % self.connection.get_server_info()) |
| | 423 | raise Exception('Unable to determine MySQL version from version string %r' % server_info) |
| 415 | 424 | self.server_version = tuple([int(x) for x in m.groups()]) |
| 416 | 425 | return self.server_version |
| 417 | 426 | |