--- a/connection.py 2018-11-02 06:09:19.000000000 +0100 +++ b/connection.py 2018-11-02 06:09:36.000000000 +0100 @@ -163,7 +163,7 @@ handshake=self._handshake, username=username, password=password, database=database, charset=charset, client_flags=client_flags, - ssl_enabled=self._ssl_active, + ssl_enabled=self._ssl_active or isinstance(self._socket, MySQLUnixSocket), auth_plugin=self._auth_plugin) self._socket.send(packet) self._auth_switch_request(username, password) @@ -192,7 +192,7 @@ (new_auth_plugin, auth_data) = self._protocol.parse_auth_switch_request(packet) auth = get_auth_plugin(new_auth_plugin)( - auth_data, password=password, ssl_enabled=self._ssl_active) + auth_data, password=password, ssl_enabled=self._ssl_active or isinstance(self._socket, MySQLUnixSocket)) response = auth.auth_response() self._socket.send(response) packet = self._socket.recv() @@ -200,7 +200,7 @@ if packet[4] == 1: auth_data = self._protocol.parse_auth_more_data(packet) auth = get_auth_plugin(new_auth_plugin)( - auth_data, password=password, ssl_enabled=self._ssl_active) + auth_data, password=password, ssl_enabled=self._ssl_active or isinstance(self._socket, MySQLUnixSocket)) if new_auth_plugin == "caching_sha2_password": response = auth.auth_response() if response: @@ -705,7 +705,7 @@ handshake=self._handshake, username=username, password=password, database=database, charset=charset, client_flags=self._client_flags, - ssl_enabled=self._ssl_active, + ssl_enabled=self._ssl_active or isinstance(self._socket, MySQLUnixSocket), auth_plugin=self._auth_plugin) self._socket.send(packet, 0, 0)