linux环境中mysql导出csv文件

来源:互联网 发布:屏幕画笔软件 编辑:程序博客网 时间:2024/06/05 03:10

采用命令行的方式导出



导出csv:


SELECT 
    * from tab 
into outfile '/opt/backup/test.csv'   
fields terminated by ',' optionally enclosed by '"' escaped by '"'    
lines terminated by '\r\n'; 

如果没权限,需用root用户进行赋权:
grant file on *.* to 'username'@'localhost';


导出目录如果没有读写权限,需要赋读写权限后能导出csv文件

0 0
原创粉丝点击