Mysql 查询所有表的行数和大小

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

Mysql 查询所有表的行数和大小


[plain] view plain copy
  1. [[email protected] ~]$ mysql -u root -p    
  2. Enter password:   
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.  
  4. Your MySQL connection id is 36  
  5. Server version: 5.6.16 MySQL Community Server (GPL)  
  6.   
  7. Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.  
  8.   
  9. Oracle is a registered trademark of Oracle Corporation and/or its  
  10. affiliates. Other names may be trademarks of their respective  
  11. owners.  
  12.   
  13. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  
  14.   
  15. mysql> show database;  
  16. 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  
  17. mysql> show databases;  
  18. +--------------------+  
  19. | Database           |  
  20. +--------------------+  
  21. | information_schema |  
  22. | fire               |  
  23. | hive               |  
  24. | lir                |  
  25. | mysql              |  
  26. | performance_schema |  
  27. | test               |  
  28. +--------------------+  
  29. 7 rows in set (0.03 sec)  
  30.   
  31. mysql> use fire;  
  32. Reading table information for completion of table and column names  
  33. You can turn off this feature to get a quicker startup with -A  
  34.   
  35. Database changed  
  36. mysql> load data infile 'aa.txt' into table firewallb;  
  37. ERROR 13 (HY000): Can't get stat of '/var/lib/mysql/fire/aa.txt' (Errcode: 2 - No such file or directory)  
  38. mysql> load data infile '/home/dss/aa.txt' into table firewallb;  
  39. ERROR 13 (HY000): Can't get stat of '/home/dss/aa.txt' (Errcode: 13 - Permission denied)  
  40. mysql> load data infile '/tmp/aa.txt' into table firewallb;  
  41. Query OK, 10 rows affected (0.07 sec)  
  42. Records: 10  Deleted: 0  Skipped: 0  Warnings: 0  
  43.   
  44. mysql> load data infile '/tmp/fireb.txt' into table firewallb;  
[plain] view plain copy
  1. Query OK, 16600931 rows affected (38 min 25.54 sec)  
  2. 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;


https://blog.****.net/wind520/article/details/38728655