0

could somebody help me with the following query, I am pretty new

SELECT * FROM information_schema.columns Where TABLE_SCHEMA='test';
INTO OUTFILE 'file.csv'; 
FIELDS TERMINATED BY ',';

Thank you.

Raja G
  • 5,973
  • 14
  • 49
  • 82

1 Answers1

1
SELECT * FROM information_schema.columns Where TABLE_SCHEMA='test'
INTO OUTFILE 'file.csv'
FIELDS TERMINATED BY ',';

Why have you mentioned ; this in all the rows??

MySQL may be writing the file into its own data directory, like /var/lib/mysql/<databasename> for example. To specify the path, use a full path.

However, it must be a directory that is writable by the user account the MySQL server daemon is running under. For that reason, I'll often use /tmp:

Specify the path you want to write to as in:

INTO OUTFILE '/tmp/mydata.csv'
Amarnath Balasubramanian
  • 9,300
  • 8
  • 34
  • 62