Search code examples
mysqlmariadbinto-outfileselect-into-outfile

Where does MariaDB `mysql` client save the output file of a select statement?


From this documentation: https://mariadb.com/kb/en/library/select-into-outfile/

I ran

MariaDB []> select ... into outfile 'leads_ny.csv';
Query OK, 6674 rows affected (0.47 sec)

Now I can't find the file. I looked in the current working directory, the directory I started mysql in, my home directory, I even ran find on each of those, but I can't find it. I'm currently running $ find / -name leads_ny.csv.

mysql Ver 15.1 Distrib 10.1.30-MariaDB


Solution

  • Found it! Was in the DB data directory

    /var/lib/mysql/dbname/leads_ny.csv