Databases
MySQL
Inspect schemas, query rows and reason about transactions.
Connect and inspect
mysql -h localhost -u app -pPrompt for the password rather than putting it in shell historySHOW DATABASES;List databases visible to your accountUSE app;Choose the default databaseSHOW CREATE TABLE users;Inspect the complete table definitionRead data
SELECT id, name FROM users ORDER BY id LIMIT 20;Fetch a predictable pageSELECT role, COUNT(*) FROM users GROUP BY role;Count users per roleSELECT * FROM users WHERE name LIKE 'A%';Match a string prefixEXPLAIN SELECT * FROM users WHERE email = 'ada@example.com';Inspect the chosen access pathTransactions and indexes
START TRANSACTION;Begin a transaction on transactional tablesCOMMIT;Persist the current transactionROLLBACK;Undo uncommitted changesSHOW INDEX FROM users;Inspect indexed columns and uniqueness