如何在 MySQL 命令列中垂直列出資料庫?


可以使用反斜槓後跟 G,即 \G 而非分號 (;)。語法如下,用於在 MySQL 命令列中垂直顯示資料庫名稱

SHOW DATABASES \G

要垂直顯示所有資料庫名稱,需要使用 \G。查詢如下

mysql> show databases\G

以下是輸出

*************************** 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)

更新於:30-Jul-2019

188 次瀏覽

啟動您的 職業

透過完成課程獲得認證

開始
廣告
© . All rights reserved.