parent
fe7349495b
commit
b48dd31cf3
@ -1,29 +0,0 @@
|
||||
"""
|
||||
pip install aiomysql
|
||||
"""
|
||||
import logging
|
||||
|
||||
from aiomysql import create_pool
|
||||
|
||||
from Config.Config import *
|
||||
|
||||
# 配置日志
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# MySQL 配置
|
||||
MYSQL_CONFIG = {
|
||||
"host": MYSQL_HOST,
|
||||
"port": MYSQL_PORT,
|
||||
"user": MYSQL_USER,
|
||||
"password": MYSQL_PASSWORD,
|
||||
"db": MYSQL_DB_NAME,
|
||||
"minsize": 1,
|
||||
"maxsize": 20,
|
||||
"charset": "utf8mb4"
|
||||
}
|
||||
|
||||
|
||||
# 初始化 MySQL 连接池
|
||||
async def init_mysql_pool():
|
||||
return await create_pool(**MYSQL_CONFIG)
|
Binary file not shown.
Loading…
Reference in new issue