在mysql/ target=_blank class=infotextkey>mysql数据库中导入大量数据的简便方法,可以借助load data local infile方式实现,例如:
复制代码 代码示例:
load data local infile '/var/www/www.csdn.net.sql'
replace into table csdn fields terminated by ' # ' lines terminated by 'n' (username,password,email);
运行结果:
复制代码 代码示例:
mysql> load data local infile '/var/www/www.csdn.net.sql' replace into table csdn fields terminated by ' # ' lines terminated by 'n' (username,password,email);
Query OK, 6428632 rows affected, 298 warnings (1 min 17.44 sec)
Records: 6428632 Deleted: 0 Skipped: 0 Warnings: 295
注意:建表时不要索引!不然速度慢得受不了。不过,优良的数据库系统,建议还是要加上索引的。