修补数据库安装脚本未指定端口问题
This commit is contained in:
+4
-1
@@ -1,4 +1,5 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append('../')
|
sys.path.append('../')
|
||||||
import sqlparse
|
import sqlparse
|
||||||
import pymysql
|
import pymysql
|
||||||
@@ -24,7 +25,8 @@ def init_database():
|
|||||||
|
|
||||||
|
|
||||||
def execute_fromfile(filename):
|
def execute_fromfile(filename):
|
||||||
db = pymysql.connect(host=HOST, user=USERNAME, password=PASSWORD, database=DATABASE, charset='utf8mb4')
|
db = pymysql.connect(host=HOST, port=int(PORT), user=USERNAME, password=PASSWORD, database=DATABASE,
|
||||||
|
charset='utf8mb4')
|
||||||
fd = open(filename, 'r', encoding='utf-8')
|
fd = open(filename, 'r', encoding='utf-8')
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
sqlfile = fd.read()
|
sqlfile = fd.read()
|
||||||
@@ -53,5 +55,6 @@ def init_db():
|
|||||||
print('表创建成功')
|
print('表创建成功')
|
||||||
print('欢迎使用pear-admin-flask,请使用 flask run 命令启动程序')
|
print('欢迎使用pear-admin-flask,请使用 flask run 命令启动程序')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
init_db()
|
init_db()
|
||||||
|
|||||||
Reference in New Issue
Block a user