邵珠庆の博客 生命只有一次,你可以用它来做些更多伟大的事情–Make the world a little better and easier

1210月/1118

Mysql导出表结构及表数据 mysqldump用法

命令行下具体用法如下:  mysqldump -u用戶名 -p密码 -d 數據库名 表名 脚本名;

    1、导出數據库為dbname的表结构(其中用戶名為root,密码為dbpasswd,生成的脚本名為db.sql)
    mysqldump -uroot -pdbpasswd -d dbname >db.sql;

    2、导出數據库為dbname某张表(test)结构
    mysqldump -uroot -pdbpasswd -d dbname test>db.sql;

    3、导出數據库為dbname所有表结构及表數據(不加-d)
    mysqldump -uroot -pdbpasswd  dbname >db.sql;

    4、导出數據库為dbname某张表(test)结构及表數據(不加-d)
    mysqldump -uroot -pdbpasswd dbname test>db.sql;

 

mysql查表大小

查整个库的状态:
select concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,
concat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,
concat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,
concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
from information_schema.tables where TABLE_SCHEMA = 'databasename';

查单表:
select concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,
concat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,
concat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,
concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
from information_schema.tables where TABLE_NAME = 'tablename';

邵珠庆推荐文章

博文加载中...

anyShare分享到:

喜欢这个文章吗?

考虑订阅我们的RSS Feed吧!

发布在 邵珠庆

评论 (18) 引用 (0)
  1. Thanks for sharing your thoughts about 邵珠庆.
    Regards

  2. I have an ingrown hair on my chin. It looks like a spot, but it’s an ingrown hair. I cannot underline just how much it’s annoying me.

  3. Kassettenmarkise test fleischkonsum statistik haarband zopf umtauschrecht saturn geretsrieder merkur beamtenkredit rechenmethoden franosch .

  4. Get Money With Scholarships for Minorities…

  5. 好久没来了。来看看。


Leave a comment

*

还没有引用.