Mysql queries the number and size of all tables.

Source: Internet
Author: User
SELECTTABLE_NAME, TABLE_ROWS, DATA_LENGTH10241024DATA_LENGTH, CREATE_TIME, TABLE_COLLATIONFROMINFORMATION_SCHEMA.TABLESWHERETABLE_SCHEMAlirORDERBYTABLE_ROWSDESC [dss @ localhost ~] $ Mysql-uroot-pEnterpassword: Welcometoth

SELECT TABLE_NAME, TABLE_ROWS, DATA_LENGTH/1024/1024 DATA_LENGTH, CREATE_TIME, TABLE_COLLATION FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'lile' 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 = 'lil' 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 36Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.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 1mysql> 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 namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> 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: 0mysql> 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

Import data files to mysql


Mysql exports data to a file

SELECT * into outfile '/tmp/bb.csv' fields terminated by ', 'Lines terminated by' \ r \ n' FROM bb_month;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.