I have a database in mysql which called
testdb, wherein lies a table named
log, the structure of the table is as followed.
So basically what I want do is to insert millions of records into the table to test the speed and stuff. Since it’s impossible for me to achieve this goal manually, I have to write a python script. This is what the script is like.
The above script could insert 100000 * 10 = 1000000 records into the table. To use this script, you have to install
mysqldb module, this is the way to install it(from stackoverflow).
easy_install mysql-python (mix os) pip install mysql-python (mix os)
apt-get install python-mysqldb (Linux Ubuntu, …) cd
/usr/ports/databases/py-MySQLdb && make install clean (FreeBSD) yum
install MySQL-python (Linux Fedora, CentOS …)