0

I have an sql database backup, and I am trying to get the data out of it to restore.

from 'wp_posts' I want to write down to separate files all columns 'post_content' from each row of this table, with 'post_title' as a file name.

I found an example statement here https://stackoverflow.com/questions/23389518/export-mysql-rows-into-different-files,

- - - - - - EDIT - - - - - - - 

This is what I have :

SELECT CONCAT( 'SELECT html from wp_posts where post_title=''', post_title, "", ' INTO OUTFILE ''', '/tmp/wps/', CAST(id AS CHAR), '_', post_title, '.html'';')

FROM wp_posts ORDER BY id;

So right now, this query statement is being executed without any errors. But I do not have any files in '/tmp/wps/' (yes, folder do exist). So what's wrong in this statement?

2
  • Why can't you use that solution, what is the issue?
    – Peter
    Apr 13, 2023 at 7:34
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Apr 13, 2023 at 9:52

1 Answer 1

0

Stick that code in a Stored Procedure, but deliver the generated SELECT to an @variable. Then PREPARE and EXECUTE it.

CALL the stored proc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.