mysql 导出导入

1,select ... into outfile 文件保存再db服务器上

SHOW VARIABLES LIKE "secure_file_priv"; 查出导入文件的可以保存的目录
+------------------+-----------------------+
| Variable_name | Value |
+------------------+-----------------------+
| secure_file_priv | /var/lib/mysql-files/ |
+------------------+-----------------------+

select app_key,ip,name,created into outfile '/var/lib/mysql-files/a.csv' fields terminated by ',' enclosed by '' lines terminated by '\n' from test.app_ip ;
Query OK, 1 row affected (0.00 sec)

#fields terminated by ',' 逗号分隔

#enclosed by '' 生成的字段内容被什么符号包围

#lines terminated by '\n' 每行以什么结尾

FAQ:ERROR 1064 (42000) 导出的目录没有权限

 

上一篇:重温hive的一些记录和想法


下一篇:mysql逻辑导入与导出