mirror of
https://github.com/Kakune55/PyGetGPT.git
synced 2025-06-29 00:08:04 +08:00
将数据库的配置转移到外置文件保存
This commit is contained in:
parent
1a4ea051e3
commit
daeaee2d41
@ -1,13 +1,13 @@
|
||||
import pymysql
|
||||
import pymysql , config
|
||||
|
||||
|
||||
def userSurplus(userkey):
|
||||
#打开数据库连接
|
||||
db = pymysql.connect(host='www.kakuweb.top',
|
||||
port=33306,
|
||||
user='root',
|
||||
password='KAku3.14159..',
|
||||
database='AIapi')
|
||||
db = pymysql.connect(host=config.readConf()["db"]["host"],
|
||||
port=config.readConf()["db"]["port"],
|
||||
user=config.readConf()["db"]["user"],
|
||||
password=config.readConf()["db"]["passwd"],
|
||||
database=config.readConf()["db"]["database"])
|
||||
# 使用 cursor() 方法创建一个游标对象 cursor
|
||||
cursor = db.cursor()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user