Exporting WordPress post content from MySQL into a file

I can never remember how to do this, so leaving this here:

select post_title, post_content from wp_posts
order by post_date asc 
into outfile '/var/lib/mysql-files/yourfile.txt';

Also see:

mysql ‘select … into outfile’ access denied

Exporting select result from MySQL and getting the error ‘ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option’

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.