Ai_GirlFriend/最终验证.py

26 lines
761 B
Python
Raw Permalink Normal View History

2026-02-28 09:40:18 +08:00
import pymysql
conn = pymysql.connect(host='localhost', port=3306, user='root', password='rootx77', database='fastadmin', charset='utf8mb4')
cursor = conn.cursor()
cursor.execute("SHOW TABLES")
tables = cursor.fetchall()
print(f"✅ fastadmin 数据库有 {len(tables)} 张表")
print("\n检查关键表:")
for t in ['nf_user', 'nf_lovers', 'nf_chat_message', 'nf_chat_session']:
cursor.execute(f"SHOW TABLES LIKE '{t}'")
result = cursor.fetchone()
if result:
cursor.execute(f"SELECT COUNT(*) FROM {t}")
count = cursor.fetchone()[0]
print(f"{t} (有 {count} 条数据)")
else:
print(f"{t}")
cursor.close()
conn.close()
print("\n✅ 数据库配置完成!")
print("现在可以启动服务了")