第四章 元数据 索引

元数据  索引

一 元数据

获取元数据:
information_schema

mysql> SELECT TABLE_NAME, ENGINE FROM  INFORMATION_SCHEMA.TABLES WHERE  TABLE_SCHEMA = 'world';
+-----------------+--------+
| TABLE_NAME      | ENGINE |
+-----------------+--------+
| city            | InnoDB |
| consumer        | InnoDB |
| country         | InnoDB |
| countrylanguage | InnoDB |
+-----------------+--------+
4 rows in set (0.00 sec)
mysql> SELECT TABLE_SCHEMA, COUNT(*) FROM   INFORMATION_SCHEMA.TABLES GROUP BY TABLE_SCHEMA;
+--------------------+----------+
| TABLE_SCHEMA       | COUNT(*) |
+--------------------+----------+
| db1                |       15 |
| db10               |        1 |
| db2                |        4 |
| db3                |        2 |
| db4                |        1 |
| index_test         |        1 |
| information_schema |       59 |
| library            |       11 |
| llf                |        2 |
| mysql              |       28 |
| orm                |       11 |
| performance_schema |       52 |
| web_yuan           |        1 |
| world              |        4 |
+--------------------+----------+
14 rows in set (0.00 sec)
mysql> select table_schema ,table_name from information_schema.tables where table_schema='world';
+--------------+-----------------+
| table_schema | table_name      |
+--------------+-----------------+
| world        | city            |
| world        | consumer        |
| world        | country         |
| world        | countrylanguage |
+--------------+-----------------+
mysql> select concat("mysqldump -uroot -poldboy123  ",table_schema," ",table_name," >>","/backup/",table_schema,"_",table_name,".bak.sql") from information_schema.tables where table_schema='world';
+------------------------------------------------------------------------------------------------------------------------------+
| concat("mysqldump -uroot -poldboy123  ",table_schema," ",table_name," >>","/backup/",table_schema,"_",table_name,".bak.sql") |
+------------------------------------------------------------------------------------------------------------------------------+
| mysqldump -uroot -poldboy123  world city >>/backup/world_city.bak.sql                                                        |
| mysqldump -uroot -poldboy123  world consumer >>/backup/world_consumer.bak.sql                                                |
| mysqldump -uroot -poldboy123  world country >>/backup/world_country.bak.sql                                                  |
| mysqldump -uroot -poldboy123  world countrylanguage >>/backup/world_countrylanguage.bak.sql                                  |
+------------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)

二  索引

猜你喜欢

转载自www.cnblogs.com/augustyang/p/11465088.html