天天看點

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

步驟1 - 連接配接到MySQL資料庫伺服器:

[[email protected]]# 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優化1]centos中MySQL列出所有表

退出資料庫

mysql> exit

步驟2 -切換到ytkah資料庫(進入到具體的資料庫):

mysql> USE ytkah;

Database changed

表示進入到ytkah這個資料庫

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

步驟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)

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

轉載于:https://www.cnblogs.com/ytkah/p/10415814.html