From a4ac9e8ec024179685259f97a3c76c8725181cac Mon Sep 17 00:00:00 2001 From: codingPF Date: Tue, 28 Apr 2020 11:55:00 +0200 Subject: [PATCH] Mysql native password#136 (#151) * added mysql_native_password * added parameter auth_plugin = 'mysql_native_password' for mysql * added comment * catch Exception Co-authored-by: SB --- resources/lib/storemysql.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/resources/lib/storemysql.py b/resources/lib/storemysql.py index c2fd7c7..5bddd1c 100644 --- a/resources/lib/storemysql.py +++ b/resources/lib/storemysql.py @@ -66,12 +66,22 @@ def init(self, reset=False, convert=False): if reset: self.logger.warn('Reset not supported') try: - self.conn = mysql.connector.connect( - host=self.settings.host, - port=self.settings.port, - user=self.settings.user, - password=self.settings.password - ) + # TODO Kodi 19 - we can update to mysql connector which supports auth_plugin parameter + try: + self.conn = mysql.connector.connect( + host=self.settings.host, + port=self.settings.port, + user=self.settings.user, + password=self.settings.password + ) + except Exception: + self.conn = mysql.connector.connect( + host=self.settings.host, + port=self.settings.port, + user=self.settings.user, + password=self.settings.password, + auth_plugin = 'mysql_native_password' + ) try: cursor = self.conn.cursor() cursor.execute('SELECT VERSION()')