Export only pages and posts with mysql dump

This is generally not a good idea. See this WordPress database diagram. You need to consider:

  • posts that have categories or tags (terms), their relationships, term meta, and taxonomies
  • posts that have authors (users)
  • posts that have comments
  • things that are actually posts that you might not realise are posts (eg. almost everything in WordPress is a post – many plugins store their data as posts, some examples are Contact Form 7, Advanced Custom Fields field groups, and many many more)
  • anything else that might have been modified on your development install that isn’t in sync with the live server (eg. are you sure no records have changed in the options table?)

In general, you should have a “live” copy of your database and any changes you make to your development database should be for testing purposes only, before you then repeat those changes on your live server. Doing anything else risks a long and protracted hunt through all of your data to ensure its integrity. Merging two databases is never fun.

Without knowing all the details of your situation, some options you potentially have might be:

  • WordPress import/export (which you said you tried, but it’s unclear why this didn’t work)
  • Manually re-inserting the posts you need to (which may or may not be prohibitive based on the number of them)
  • Adding the posts to a fresh table, then writing a script to loop through the records and run wp_insert_post() on each one
  • Grab a mysqldump of each database and do a diff to determine how much has really changed in the live site, and decide whether you can just override the database and manually set any options

There may be other solutions as well, and the best will depend on the details of your situation. With the information we have so far, I’d probably be leaning towards the scripting option above.

EDIT: Since this answer was originally written, Mergebot has been released. I haven’t used it so can’t vouch for it, but it looks promising, and the author has a track record of producing good plugins.

error code: 523