【mysqldump】导出sql脚本,不能使用select导出部分字段
导出
>mysqldump -hlocalhost -P3307 -uroot -p123456 mydb mytable --where="id = 412123456" --hex-blob --add-drop-table=false --add-locks=false --no-create-info=true>"d:\export.sql"
导入
>mysql -hlocalhost -P3307 -uroot -p123456 mydb <export.sql
或者先mysql登录,切换DB,执行source export.sql
【sql】导出数据,可以使用select语句
select id, c1, c2, c3, c4, c5, c6, c7, c8 from mydb.mytable limit 100 into outfile
'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/out.csv' fields Terminated by',' lines terminated by'\r\n';
导入
load data infile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/out.csv' into table mydb.mytable
【mysql】导出数据,可以使用select
mysql -h192.168.1.12 -P3307 -uroot -p123456 test -e "select id,name,age from usertable" > d:\users.csv