简体   繁体   中英

SELECT * INTO OUTFILE directory

I am trying to generate a file from mysql. The I am using is:

SELECT * INTO OUTFILE $_SERVER['DOCUMENT_ROOT']/data.txt FIELDS TERMINATED BY ',' FROM admin";

The code is working fine as I am not getting any error. But the problem is I could not locate where the file is created. Would any body please help me.

I am using a shared hosting.

Thanks

The query should be run like this, I mean it should be quoted.

mysql_query("SELECT * INTO OUTFILE '{$_SERVER['DOCUMENT_ROOT']}/data.txt' FIELDS TERMINATED BY ',' FROM admin";");

To successfully run this query you'll need these

  1. User must have FILE privilege
  2. MYSQL server daemon must have write privilege to $_SERVER['DOCUMENT_ROOT']/data.txt . And this directory must be accessible.

you are using shared hosting then good way to connect ftp and get the path of physical working directory, you can get form "pwd" linux command

use that path because at the shared host make some time issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM