Mysql中如何批量生成脚本
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 3 to server version: 5.1.26-rc-log
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> use information_schema
+---------------------------------------+
| Tables_in_information_schema |
+---------------------------------------+
| CHARACTER_SETS |
| COLLATIONS |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMN_PRIVILEGES |
| ENGINES |
| EVENTS |
| FILES |
| GLOBAL_STATUS |
| GLOBAL_VARIABLES |
| KEY_COLUMN_USAGE |
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
| PROFILING |
| REFERENTIAL_CONSTRAINTS |
| ROUTINES |
| SCHEMATA |
| SCHEMA_PRIVILEGES |
| SESSION_STATUS |
| SESSION_VARIABLES |
| STATISTICS |
| TABLES |
| TABLE_CONSTRAINTS |
| TABLE_PRIVILEGES |
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
+---------------------------------------+
28 rows in set (0.00 sec)
+---------------------------------------------------------+
| concat("delete from ",table_schema,".",table_name,";") |
+---------------------------------------------------------+
| delete from mysql.columns_priv; |
| delete from mysql.db; |
| delete from mysql.event; |
| delete from mysql.func; |
| delete from mysql.general_log; |
| delete from mysql.help_category; |
| delete from mysql.help_keyword; |
| delete from mysql.help_relation; |
| delete from mysql.help_topic; |
| delete from mysql.host; |
| delete from mysql.ndb_binlog_index; |
| delete from mysql.plugin; |
| delete from mysql.proc; |
| delete from mysql.procs_priv; |
| delete from mysql.servers; |
| delete from mysql.slow_log; |
| delete from mysql.tables_priv; |
| delete from mysql.time_zone; |
| delete from mysql.time_zone_leap_second; |
| delete from mysql.time_zone_name; |
| delete from mysql.time_zone_transition; |
| delete from mysql.time_zone_transition_type; |
| delete from mysql.user; |
+---------------------------------------------------------+
23 rows in set (0.01 sec)
建议继续学习:
扫一扫订阅我的微信号:IT技术博客大学习
- 作者:Incessant 来源: Incessant
- 标签: 批量
- 发布时间:2009-10-11 22:32:51
- [356] Go Reflect 性能
- [30] 正态分布的前世今生(一)
- [17] 基于HTTP缓存轻松实现客户端应用的离线支持
- [17] 公钥私钥加密解密数字证书数字签名详解
- [15] osx平台上lol英雄联盟launcher启
- [14] 无锁HashMap的原理与实现
- [14] Joomla反序列化漏洞的查漏补缺
- [13] 我的git笔记
- [13] Linux内存中的Cache真的能被回收么?
- [13] 在JavaScript中什么时候使用==是正