[adsense id=”0514458240″ width=”468″ height=”60″]
In order to use MySQL’s OUTFILE requires the user to have FILE privilege. The FILE privilege is not assigned on a per database but at a system level, hence the use of ‘*.*’.
mysql> grant FILE on *.* TO ronan@localhost; Query OK, 0 rows affected (0.06 sec)
Be sure that the folder that you are exporting to is writable by the MySQL server user. Here is an example of what is returned if you attempt to write to a folder that does not have the correct permissions:
mysql> select * into outfile '/home/toto.txt' from t1; ERROR 1 (HY000): Can't create/write to file '/home/toto.txt' (Errcode: 13)
[googleplus]