2026-08-17 12:25:42 +08:00
|
|
|
|
const mysql = require('mysql2/promise');
|
|
|
|
|
|
(async () => {
|
2026-09-23 16:34:08 +08:00
|
|
|
|
// 🔴 口令不再内置明文(2026-09-23 入库口令处置 P2)。运行前请注入 DB_PASSWORD:
|
|
|
|
|
|
// DB_PASSWORD='<本机 DB 口令>' node show_tables.js
|
2026-08-17 12:25:42 +08:00
|
|
|
|
const c = await mysql.createConnection({
|
2026-09-23 16:34:08 +08:00
|
|
|
|
host: process.env.DB_HOST || 'localhost',
|
|
|
|
|
|
user: process.env.DB_USER || 'root',
|
|
|
|
|
|
password: process.env.DB_PASSWORD,
|
|
|
|
|
|
database: process.env.DB_NAME || 'competition_db',
|
2026-08-17 12:25:42 +08:00
|
|
|
|
});
|
|
|
|
|
|
const [t] = await c.query('SHOW TABLES');
|
|
|
|
|
|
t.forEach(r => console.log(Object.values(r)[0]));
|
|
|
|
|
|
await c.end();
|
|
|
|
|
|
})();
|