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

WBOY
发布: 2016-06-07 15:46:26
原创
1862 人浏览过

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

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


[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.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!