26 lines
761 B
Python
26 lines
761 B
Python
|
|
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("现在可以启动服务了")
|