mysql -e 'SHOW DATABASES;'

Category: Databases & SQL

mysql -e 'SHOW DATABASES;'

List databases without entering the client

-e runs the statement and exits, so it slots into scripts. SHOW DATABASES lists every database you can see, like psql's \l. Related: SHOW TABLES inside a database.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.