From 67c2c2512c01b91e73b67b4d4199ec37bb8d26b8 Mon Sep 17 00:00:00 2001 From: sniper-py Date: Mon, 2 Dec 2019 16:37:20 +0800 Subject: [PATCH] fix unix_socket --- scripts/setup-seafile-mysql.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/setup-seafile-mysql.py b/scripts/setup-seafile-mysql.py index 2a714bb..cdb5c8c 100644 --- a/scripts/setup-seafile-mysql.py +++ b/scripts/setup-seafile-mysql.py @@ -478,11 +478,13 @@ Please choose a way to initialize seafile databases: def check_mysql_user(self, user, password, host=None, unix_socket=None): print('\nverifying password of user %s ... ' % user, end=' ') - kwargs = dict(host=host or self.mysql_host, - port=self.mysql_port, + kwargs = dict(port=self.mysql_port, user=user, - passwd=password, - unix_socket=unix_socket) + passwd=password) + if unix_socket: + kwargs['unix_socket'] = unix_socket + else: + kwargs['host'] = host or self.mysql_host try: conn = pymysql.connect(**kwargs)