要取得MySQL資料庫列表,以下是語法-
show databases;
要取得伺服器版本,您可以使用下列語法-
select version();
讓我們實現上述語法來取得MySQL資料庫和版本的清單-
mysql> show databases;
這將產生以下輸出,顯示所有資料庫-
+---------------------------+ | Database | +---------------------------+ | bothinnodbandmyisam | | business | | commandline | | customer-tracker | | customer_tracker_database | | customertracker | | database1 | | databasesample | | demo | | education | | hb_student_tracker | | hello | | information_schema | | instant_app | | javadatabase2 | | javasampledatabase | | login | | mybusiness | | mydatabase | | mysql | | onetomanyrelationship | | onlinebookstore | | performance_schema | | rdb | | sample | | sampledatabase | | schemasample | | slotgame | | sys | | test | | test3 | | tracker | | universitydatabase | | web | | web_tracker | | webtracker | +---------------------------+ 36 rows in set (0.00 sec)
以下是取得版本的查詢-
mysql> select version();
這將產生以下輸出-
+-----------+ | version() | +-----------+ | 8.0.12 | +-----------+ 1 row in set (0.00 sec)
以上是取得 MySQL 資料庫和版本的清單?的詳細內容。更多資訊請關注PHP中文網其他相關文章!