| 123456789101112131415 |
- # -*- coding: utf-8 -*-
- """列出库内所有表"""
- import re
- import pymysql
- YML = r"C:\Users\Administrator\WorkBuddy\2026-10-17-12-27-10\java-rewrite\yoshop-java\src\main\resources\application.yml"
- text = open(YML, encoding="utf-8").read()
- pwd = re.findall(r"password:\s*(.+)", text)[0].strip().strip("\"'")
- conn = pymysql.connect(host="192.168.1.177", port=3306, user="root", password=pwd, database="shop")
- cur = conn.cursor()
- cur.execute("SELECT table_name FROM information_schema.tables WHERE table_schema='shop' ORDER BY table_name")
- for (t,) in cur.fetchall():
- print(t)
- conn.close()
|