Mysql 查询所有表的行数和大小
程序员文章站
2022-06-09 13:55:14
...
SELECT TABLE_NAME,TABLE_ROWS,DATA_LENGTH/1024/1024 DATA_LENGTH,CREATE_TIME,TABLE_COLLATION FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'lir' ORDER BY TABLE_ROWS DESC [dss@localhost ~]$ mysql -u root -p Enter password: Welcome to th
SELECT TABLE_NAME,TABLE_ROWS,DATA_LENGTH/1024/1024 "DATA_LENGTH",CREATE_TIME,TABLE_COLLATION FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'lir' ORDER BY TABLE_ROWS DESC
[dss@localhost ~]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 36 Server version: 5.6.16 MySQL Community Server (GPL) Copyright (c) 2000, 2014, 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> show database; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | fire | | hive | | lir | | mysql | | performance_schema | | test | +--------------------+ 7 rows in set (0.03 sec) mysql> use fire; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> load data infile 'aa.txt' into table firewallb; ERROR 13 (HY000): Can't get stat of '/var/lib/mysql/fire/aa.txt' (Errcode: 2 - No such file or directory) mysql> load data infile '/home/dss/aa.txt' into table firewallb; ERROR 13 (HY000): Can't get stat of '/home/dss/aa.txt' (Errcode: 13 - Permission denied) mysql> load data infile '/tmp/aa.txt' into table firewallb; Query OK, 10 rows affected (0.07 sec) Records: 10 Deleted: 0 Skipped: 0 Warnings: 0 mysql> load data infile '/tmp/fireb.txt' into table firewallb;
Query OK, 16600931 rows affected (38 min 25.54 sec) Records: 16600931 Deleted: 0 Skipped: 0 Warnings: 0
导入数据文件到mysql
mysql导出数据到文件
SELECT * INTO OUTFILE '/tmp/bb.csv' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' FROM bb_month;
推荐阅读
-
php列出mysql表所有行和列的方法
-
Python MySQL进行数据库表变更和查询
-
查询单个库中所有表磁盘占用大小的SQL语句分享
-
SQL SERVER查询数据库所有表的大小,按照记录数降序排列
-
Sql查询MySql数据库中的表名和描述表中字段(列)信息
-
mysql 查询 两个表中不同字段的 和,并通过两个表的时间来分组
-
使用SQL语句查询MySQL,SQLServer,Oracle所有数据库名和表名,字段名
-
实战:mysql统计指定架构的所有表的数据和索引大小情况_MySQL
-
linux下mysql查询,库名称和表名称不区分大小写
-
实战:mysql统计指定架构的所有表的数据和索引大小情况_MySQL