How to list databases vertically in MySQL command line?


You can use backward slash followed by G i.e. \G instead of semicolon(;). The syntax is as follows to display database names vertically in MySQL command line

SHOW DATABASES \G

To display all database names vertically, you need to use \G. The query is as follows

mysql> show databases\G

The following is the output

*************************** 1. row ***************************
Database: business
*************************** 2. row ***************************
Database: database1
*************************** 3. row ***************************
Database: databasesample
*************************** 4. row ***************************
Database: education
*************************** 5. row ***************************
Database: hello
*************************** 6. row ***************************
Database: information_schema
*************************** 7. row ***************************
Database: javadatabase2
*************************** 8. row ***************************
Database: javasampledatabase
*************************** 9. row ***************************
Database: mybusiness
*************************** 10. row ***************************
Database: mydatabase
*************************** 11. row ***************************
Database: mysql
*************************** 12. row ***************************
Database: performance_schema
*************************** 13. row ***************************
Database: rdb
*************************** 14. row ***************************
Database: sample
*************************** 15. row ***************************
Database: sampledatabase
*************************** 16. row ***************************
Database: schemasample
*************************** 17. row ***************************
Database: sys
*************************** 18. row ***************************
Database: test
*************************** 19. row ***************************
Database: test3
*************************** 20. row ***************************
Database: universitydatabase
20 rows in set (0.05 sec)

Updated on: 30-Jul-2019

133 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements