- CREATE TEMPORARY TABLE mail SELECT * FROM mail;
- SELECT COUNT(*) FROM mail;
- DELETE FROM mail;
- DROP TEMPORARY TABLE mail;
- SELECT COUNT(*) FROM mail;
查看当前表引擎
- SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ‘ekin_mysql‘ AND TABLE_NAME = ‘mail‘;
- SHOW TABLE STATUS LIKE ‘city\G‘;
更改表引擎
- ALTER TABLE mail ENGINE = ‘MyISAM‘;
使用mysqldump复制表
- mysqldum database table > mail.sql (导出表)
- mysql database < mail.sql (导入表)
将数据库所有表复制到另一个数据库中
- mysqldump database > database.sql (导出数据库)
- mysql other_db < database.sql (导入到数据库中)
- mysqldump database mail > mail.sql (导出到mail.sql表)
- mysql other_db < mail.sql (从mail表导入到other_db中)
- RENAME mail TO mail2; (将mail重命名为mail2)
- RENAME mail TO database.mail2 (同时将表复制到另一个数据库中,可以在新表名前面加上数据库名)
- mysqldump databse mail | mysql other_db (使用管道将database库中mail表复制到另外数据库)
- mysqldump database | mysql other_db (使用管道将database数据库复制到另外数据库)
- mysqldump database mail | mysql -h x.x.x other_db
- mysqldump databse mail | ssh x.x.x.x mysql other_db