1、查询数据保存为CSV文件
select * from account into outfile '/root/account.csv' fields terminated by ',' enclosed by '"' lines terminated by '\r\n'
注意:可通过终端方式查询或者服务器上连接数据查询所得。
2、将大文件数据(SQL)导入到服务器
A:将终端上查询的文件传到服务器
scp -P 端口号 -i 私钥绝对路径地址 数据存放的绝对路径 root@IP:/tmp/
B:导入数据
load data local infile '/tmp/account.csv' into table account fields terminated by ',' enclosed by '"' lines terminated by '\r\n';
注意:/tmp/account.csv 为将要导入的数据文件;account为已经存在的表