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