Mysql

查询所有数据库

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| sys |

| ttbb |

+--------------------+

5 rows in set (0.01 sec)

进入数据库一个一个清理

mysql> use ttbb

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

产生删除表的sql语句

mysql> select concat("DROP TABLE IF EXISTS ", table_name, ";") from information_schema.tables where table_schema="ttbb";

+--------------------------------------------------+

| concat("DROP TABLE IF EXISTS ", table_name, ";") |

+--------------------------------------------------+

| DROP TABLE IF EXISTS old_table_etl_scene_2; |

+--------------------------------------------------+

1 row in set (0.00 sec)

注意table_schema要替换成您的数据库名称

复制执行语句即可

mysql> DROP TABLE IF EXISTS old_table_etl_scene_2;

Query OK, 0 rows affected (0.03 sec)

Mongo

查询所有数据库

> show databases;

admin 0.000GB

config 0.000GB

local 0.000GB

test 0.000GB

ttbb 0.000GB

进入数据库

> use ttbb

switched to db ttbb

清理数据库

> db.dropDatabase();

{ "dropped" : "ttbb", "ok" : 1 }

> show databases;

admin 0.000GB

config 0.000GB

local 0.000GB

test 0.000GB

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐