Questions tagged «into-outfile»


13
如何使用SELECT INTO OUTFILE解决MySQL Errcode 13?
我正在尝试使用MySQL SELECT INTO OUTFILE语句将表的内容转储到csv文件中。如果我做: SELECT column1, column2 INTO OUTFILE 'outfile.csv' FIELDS TERMINATED BY ',' FROM table_name; outfile.csv将在服务器上与数据库文件存储在同一目录中创建。 但是,当我将查询更改为: SELECT column1, column2 INTO OUTFILE '/data/outfile.csv' FIELDS TERMINATED BY ',' FROM table_name; 我得到: ERROR 1 (HY000): Can't create/write to file '/data/outfile.csv' (Errcode: 13) Errcode 13是一个权限错误,但是即使将/ data的所有权更改为mysql:mysql并赋予它777权限,我也得到了它。MySQL以用户“ mysql”的身份运行。 奇怪的是,我可以在/ tmp中创建该文件,但是不能在我尝试过的任何其他目录中创建该文件,即使设置了权限,以便用户mysql应该能够写入该目录。 这是在Ubuntu上运行的MySQL 5.0.75。
114 mysql  sql  into-outfile 

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.