Skip to content

Commit 97b88bf

Browse files
committed
Fix auth fail on MySQL 5.1
1 parent dc012c0 commit 97b88bf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pymysql/connections.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,6 @@ def _execute_command(self, command, sql):
10511051

10521052
def _request_authentication(self):
10531053
# https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse
1054-
self.client_flag |= CLIENT.CAPABILITIES
10551054
if int(self.server_version.split('.', 1)[0]) >= 5:
10561055
self.client_flag |= CLIENT.MULTI_RESULTS
10571056

@@ -1073,7 +1072,7 @@ def _request_authentication(self):
10731072
data = data_init + self.user + b'\0'
10741073

10751074
authresp = b''
1076-
if self._auth_plugin_name == 'mysql_native_password':
1075+
if self._auth_plugin_name in ('', 'mysql_native_password'):
10771076
authresp = _scramble(self.password.encode('latin1'), self.salt)
10781077

10791078
if self.server_capabilities & CLIENT.PLUGIN_AUTH_LENENC_CLIENT_DATA:

0 commit comments

Comments
 (0)