[MySQL優化1]centos中MySQL列出所有表


步驟1 - 連接到MySQL數據庫服務器:
[root@host]# mysql -u root -p
Enter password:******
提示登陸成功
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 215827
Server version: 5.7.25-log Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

退出數據庫
mysql> exit


步驟2 -切換到ytkah數據庫(進入到具體的數據庫):
mysql> USE ytkah;
Database changed
表示進入到ytkah這個數據庫

步驟3 - 顯示ytkah數據庫中的所有表:
mysql> SHOW TABLES;
+---------------------------+
| Tables_in_ytkah |
+---------------------------+
| wp_commentmeta |
| wp_comments |
| wp_links |
| wp_options |
| wp_postmeta |
| wp_posts |
| wp_term_relationships |
| wp_term_taxonomy |
| wp_termmeta |
| wp_terms |
| wp_usermeta |
| wp_users |
+---------------------------+
14 rows in set (0.00 sec)

顯示ytkah數據庫中包含字符的所有表:
①顯示數據庫中以wp_user開頭的所有表
mysql> show tables like 'wp_user%';
+--------------------------------------+
| Tables_in_ytkah (wp_user%) |
+--------------------------------------+
| wp_usermeta |
| wp_users |
+--------------------------------------+
2 rows in set (0.00 sec)

②顯示數據庫中以users結尾的所有表
mysql> show tables like '%users';
+------------------------------------+
| Tables_in_ytkah (%users) |
+------------------------------------+
| wp_users |
+------------------------------------+
1 row in set (0.00 sec)

③顯示數據庫中包含user的所有表
mysql> show tables like '%user%';
+------------------------------------+
| Tables_in_ytkah (%user%) |
+------------------------------------+
| wp_usermeta |
| wp_users |
+------------------------------------+
2 rows in set (0.00 sec)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM