Output the contents of the table as CSV

To output the contents of the table as CSV, specify "in to out file" in the select statement. Specify "," as the delimiter and "" "in the character string enclosure.

select * from book
   into outfile'/tmp/book.csv'
   fields terminated by','
   optionally enclosed by'"';

Since the file is output with MariaDB user's authority, it is output to "/ tmp" that anyone can write.

The method of reading the output CSV is explained below.

Associated Information