| 12345678910111213141516 |
- # -*- coding: utf-8 -*-
- """列出库内所有表"""
- import re
- import pymysql
- from _root import ROOT
- YML = str(ROOT / "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()
|