mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-09-01 23:46:53 +00:00
Fix setup mysql script.
This commit is contained in:
@@ -476,12 +476,13 @@ Please choose a way to initialize seafile databases:
|
|||||||
|
|
||||||
print('done')
|
print('done')
|
||||||
|
|
||||||
def check_mysql_user(self, user, password, host=None):
|
def check_mysql_user(self, user, password, host=None, unix_socket=None):
|
||||||
print('\nverifying password of user %s ... ' % user, end=' ')
|
print('\nverifying password of user %s ... ' % user, end=' ')
|
||||||
kwargs = dict(host=host or self.mysql_host,
|
kwargs = dict(host=host or self.mysql_host,
|
||||||
port=self.mysql_port,
|
port=self.mysql_port,
|
||||||
user=user,
|
user=user,
|
||||||
passwd=password)
|
passwd=password,
|
||||||
|
unix_socket=unix_socket)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conn = pymysql.connect(**kwargs)
|
conn = pymysql.connect(**kwargs)
|
||||||
@@ -565,7 +566,7 @@ class NewDBConfigurator(AbstractDBConfigurator):
|
|||||||
# accessed from localhost with unix socket. So we retry with
|
# accessed from localhost with unix socket. So we retry with
|
||||||
# localhost when failing with 127.0.0.1.
|
# localhost when failing with 127.0.0.1.
|
||||||
if self.mysql_host == '127.0.0.1':
|
if self.mysql_host == '127.0.0.1':
|
||||||
self.root_conn = self.check_mysql_user('root', password, host='localhost')
|
self.root_conn = self.check_mysql_user('root', password, unix_socket="/var/run/mysqld/mysqld.sock")
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
return password
|
return password
|
||||||
|
Reference in New Issue
Block a user