MySQL Workbench:生成一堆行?

时间:2010-02-18 22:07:10

标签: mysql mysql-workbench

我有一个MySQL工作台模型,我用它来生成一个模式。为了解决它,我想要一堆假数据。有没有一种简单的方法可以产生这个,或者我必须手工完成它?

2 个答案:

答案 0 :(得分:8)

这是我一直用来生成虚拟数据的网站。 http://www.generatedata.com这将生成数据以及插入脚本。

答案 1 :(得分:0)

这就是我对mysql工作台所做的

表newtable的模式

create table newtable (c1 int, c2 varchar(255),create_ts timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL, update_ts timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL);

在外壳上创建了此文件foo.txt

for i in `seq 0 10000`; do echo "insert into newtable (c1,c2) values($i,'bar$i');" >> ~/Downloads/foo.txt; done

rootuser@rootuser$ cp ~/Downloads/foo.txt ~/Downloads/foo.sql

通过工作台上载文件foo.sql并运行,它将生成10K新行