diff --git a/scripts/bootstrap.py b/scripts/bootstrap.py index 5e73d6fb..db5f3782 100755 --- a/scripts/bootstrap.py +++ b/scripts/bootstrap.py @@ -120,7 +120,8 @@ def init_seafile_server(): 'MYSQL_USER': 'seafile', 'MYSQL_USER_PASSWD': str(uuid.uuid4()), 'MYSQL_USER_HOST': '%.%.%.%', - 'MYSQL_HOST': get_conf('DB_HOST','127.0.0.1'), + 'MYSQL_HOST': get_conf('DB_HOST','127.0.0.1'), + 'MYSQL_PORT': get_conf('DB_PORT','3306'), # Default MariaDB root user has empty password and can only connect from localhost. 'MYSQL_ROOT_PASSWD': get_conf('DB_ROOT_PASSWD', ''), } diff --git a/scripts/utils/__init__.py b/scripts/utils/__init__.py index 819d7388..0bab97bd 100644 --- a/scripts/utils/__init__.py +++ b/scripts/utils/__init__.py @@ -267,12 +267,13 @@ def update_version_stamp(version, fn=get_version_stamp_file()): def wait_for_mysql(): db_host = get_conf('DB_HOST', '127.0.0.1') + db_port = int(get_conf('DB_PORT', 3306)) db_user = 'root' db_passwd = get_conf('DB_ROOT_PASSWD', '') while True: try: - MySQLdb.connect(host=db_host, port=3306, user=db_user, passwd=db_passwd) + MySQLdb.connect(host=db_host, port=db_port, user=db_user, passwd=db_passwd) except Exception as e: print ('waiting for mysql server to be ready: %s', e) time.sleep(2)