How do I list MySQL databases and table structure without reading customer records?
MySQL metadata commands can show available databases and table structure without selecting application rows. The results depend on the connected account’s privileges, so an absent table is not conclusive evidence that it does not exist. Confirm your connection identity before comparing an application schema.
Before you start
- An authenticated MySQL session with access to the intended schema.
- The actual database and table names.
Instructions
1. Confirm the selected database
Check which database and account your session uses. This prevents an inspection of staging or a different tenant schema from being mistaken for production.
SELECT DATABASE(), CURRENT_USER();
SHOW DATABASES;Displays session context and databases visible to the current account.
2. List table names and types
Replace appdb with the actual schema. FULL distinguishes ordinary tables from views in the result; it does not dump their rows.
SHOW FULL TABLES FROM appdb;Reads visible table/view metadata for one database.
3. Inspect a specific table’s columns
Replace orders with the table being diagnosed. Review names and types against the application’s expected schema or migration version; do not change columns merely to match an assumed version.
SHOW COLUMNS FROM appdb.orders;Displays the selected table’s column metadata without selecting its customer data.
Check the result
- The intended schema and expected table/column names are visible for the authorised account.
- Any schema discrepancy is tied to the correct application version and environment.
Troubleshooting
- An expected table is missing from the result
- Check database selection, account privileges and identifier case. Avoid granting broad global privileges solely to make metadata appear.
- The command reports no such table
- Confirm the exact schema and table name with the application owner before attempting a migration.
Official references
Use the documentation for your installed version when a flag, service name or platform feature differs.
