导出:SELECT * from ebook INTO OUTFILE "bookdev.txt" FIELDS ENCLOSED by '"' TERMINATED by "," LINES TERMINATED BY " " 导入:LOAD DATA INFILE "bookdev.txt" into TABLE ebook FIELDS ENCLOSED by '"' TERMINATED by "," LINES TERMINATED BY " " /////////////////////////////////////// mysql sql语句导入与导出 导入: mysql -u root -p 数据库名 如: C:/mysql/bin>mysql -u root -p house < c:/1-1.txt 导出: mysqldump -u root -p 数据库名 [表名1 表名2] > 输出地址 其中表名可选 如: 导出house中的blacklist表 C:/mysql/bin>mysqldump -u root house blacklist > c:/1-1.txt 导出house中的blacklist和userinfo表 C:/mysql/bin>mysqldump -u root house blacklist userinfo> c:/1-1.txt 导出house中的所有表 C:/mysql/bin>mysqldump -u root house > c:/1-1.txt 在使用mysqldump中可以使用 "-d" ,这时只导出表结构,没有数据 如: 导出house中的所有表 ,这时只有表结构 C:/mysql/bin>mysqldump -u root -d house > c:/1-1.txt 导出:SELECT * from ebook INTO OUTFILE "bookdev.txt" FIELDS ENCLOSED by '"' TERMINATED by "," LINES TERMINATED BY "/n" 导入:LOAD DATA INFILE "bookdev.txt" into TABLE ebook FIELDS ENCLOSED by '"' TERMINATED by "," LINES TERMINATED BY "/n" 关于字符集的设置问题 -uroot -pXXX --default-character-set=gbk/utf8