我是靠谱客的博主 欢呼皮带,这篇文章主要介绍mysql数据库进行清洗,清理数据库,现在分享给大家,希望可以做个参考。

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

最后

以上就是欢呼皮带最近收集整理的关于mysql数据库进行清洗,清理数据库的全部内容,更多相关mysql数据库进行清洗内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(137)

评论列表共有 0 条评论

立即
投稿
返回
顶部