MySQL生成测试用垃圾数据

背景

在学习数据库的时候总是想拥有垃圾数据能够帮助我们进行SQL的练习,下面展示利用fake2db生成垃圾数据。

具体操作

开发环境: Ubuntu 18.04 Python3.8 MySQL8.0
1.安装Python3.8

$ conda create -n Python38 python=3.8

2.激活并使用Python3.8环境

$ conda activate Python38

3.安装fake2db

$ pip install fake2db

4.安装mysql的python驱动

$ pip install mysql-connector-python

5.生成垃圾数据

$ fake2db --rows 30 --db mysql --host 10.197.184.210 --password xxxxx --user root

6.查看垃圾数据

10.197.184.210 root:fake> show databases                                                                                           
+--------------------+
| Database           |
+--------------------+
| fake               |
| hello              |
| information_schema |
| mysql              |
| mysql_LONZXODV     |
| performance_schema |
| sys                |
| tianyi             |
+--------------------+
8 rows in set
Time: 0.028s
10.197.184.210 root:fake> use mysql_LONZXODV                                                                                       
You are now connected to database "mysql_LONZXODV" as user "root"
Time: 0.000s
10.197.184.210 root:mysql_LONZXODV> show tables;                                                                                   
+--------------------------+
| Tables_in_mysql_LONZXODV |
+--------------------------+
| company                  |
| customer                 |
| detailed_registration    |
| simple_registration      |
| user_agent               |
+--------------------------+
5 rows in set
Time: 0.019s

mysql

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值