导入数据库:
mysql>use databasename;
mysql>load data infile "E:\\test\\test.txt" into table tablename fields terminated by '|' lines terminated by '\r\n';
如果没有换行则:
mysql>load data infile "E:\\test\\test.txt" into table tablename fields terminated by '|';
导出数据库:
mysql>use databasename;
mysql> select * into outfile "E:\\test\\test.txt" fields terminated by '|'lines terminated by '\r\n' from tablename;
如果不要换行则:
mysql> select * into outfile "E:\\test\\test.txt" fields terminated by ',' from
tablename;

本文详细介绍了如何使用MySQL进行数据导入和导出操作,包括使用LOAD DATA INFILE命令从文件导入数据和使用SELECT INTO OUTFILE命令将数据库表导出到文件。文章覆盖了常见场景和注意事项,帮助开发者熟练掌握数据库数据迁移技巧。
1441

被折叠的 条评论
为什么被折叠?



