WordPress.org

Ready to get started?Download WordPress

Forums

Moving wordpress WITHOUT using phpmyadmin (10 posts)

  1. nicole2292
    Member
    Posted 2 years ago #

    Hi there,

    I have many wordpress sites which have been developed for my clients over the past few years. Frequently the clients want to move their sites to a new server and often a new domain.

    This should be a very simple process and I have been doing it for many years.

    My process is very similar to this: http://codex.wordpress.org/Moving_WordPress

    Basically I copy the files across and export the database. When the domain is changing I do a find and replace on the database sql file. Sounds very straight forward.

    THE PROBLEM:

    Many extremely popular plugins lose data when you export the database using phpmyadmin. Two such plugins which I have one of on every single site I ever build are "contact form 7" and "gravity forms".

    Both of these lose data during the move.

    Many other plugins also lose data but I'm not going to list them here.

    I have posted about this before of the respective forums for these plugins and they blame phpmyadmin. Saying it does not export the data "properly". That's all fine and dandy for them to say but how am I supposed to move my sites if not to use phpmyadmin?

    Currently I have no choice but to use php my admin and then copy over or rebuild the sections that were damaged. Usually the email details in contact form 7 and the forms in Gravity forms. All forms are actually lost in gravity forms, however their meta data restore tool is able to recover some, but not all. Some must be replaced manually.

    This is incredibly time consuming and painful to do every time I move a site.

    THE QUESTION:

    Can someone tell me exactly how I can either export from phpmyadmin and preserve all of the data (no data loss at all) or alternatively how else can I export then import the whole database and preserve it's integrity and not lose any data.

    Why are these plugins written in such a way that they contain data which is lost by phpmyadmin, the most popular database management software in the world?

    Any idea would be appreciated.

    Nicole

  2. RichardWPG
    Member
    Posted 2 years ago #

  3. nicole2292
    Member
    Posted 2 years ago #

    Hi Richard,

    Thanks for the reply. Sorry I should have mentioned that I am fully aware you can export and import the wordpress posts under "tools".

    This however always requires a whole heap of configuration to get all the widgets and other settings back to the way you had them before and as such is not a viable option at all.

    I need to move the sites EXACTLY as they are. No changes required at all other than the database details for the new server which are updated in the wp-config file. Everything else just needs to work as is, no extra work involved.

    I can currently do this with no problems for joomla sites and other database driven cms using phpmyadminexport and import. I don't know why data is lost for the wordpress plugins.

    Nicole

  4. Knut Sparhell
    Member
    Posted 2 years ago #

    All data is stored in the database. From PhpMyadmin you can export and import to .sql files. This will make an exact copy of the database, except for some irrelevant metadata about the database itself, like global default settings, storage engine(s), file sizes and table creation/modified datetimes. Then move your wp-content/uploads and /plugins folder. Adjust the wp-config.php file for correct database settings, but leave the $table_prefix untouched. Access your WordPress and log in *). Activate the plugins you had active before.

    Do not install WordPress through wp-admin/install.php before this procedure.

    This will not loose any data created through "Contact Form 7". I have moved such data with no loss, many times. The contact form data is inside the posts table, as a special post_type, and are referenced through shortcode to their post_id. If this fails, the two databases are not identical in content.

    *) You might not be able to log in using the old password, see http://codex.wordpress.org/Resetting_Your_Password

  5. nicole2292
    Member
    Posted 2 years ago #

    Hi Knut,

    Thanks for your reply too. I really don't think you guys are understanding the problem.

    I realise that all data is stored in the database and that from phpmyadmin I can export to .sql and that will make an exact copy of the database... the problem is it doesn't make an exact copy! It makes a copy which is "almost exact" but losing some RELEVANT meta data related to the contact form 7 plugin, the gravity forms plugin and various other plugins. Not all plugins, just some.

    So yes I can export from phpmyadmin and import using phpmyadmin and change my database details in wp-config.php and yes I can get the site working again... except a few small things. The form meta is lost.

    Please see http://www.gravityhelp.com/forums/topic/this-forms-meta-could-not-be-recovered and look at the post by Carl Handcock. I quote

    "The issue isn't that Gravity Forms can't be migrated. The issue is PHPMyAdmin's import/export functionality doesn't properly handle serialized data.

    The problem isn't Gravity Forms, the problem is the tool you are using to import/export MySQL data. It doesn't handle the data properly and results in bad data being imported."

    See from the above post that there is a problem with using phpmyadmin to export and import. This is not just with gravity forms. If it was I would just use anothe form plugin. It is with contact form 7 as well and some other plugins.

    So back to my original question, how do I move a site without using phpmyadmin or the wordpress tools for export / import as both are not sufficient to actually copy the complete site and all it's data?

    Nicole

  6. michael.mariart
    Member
    Posted 2 years ago #

    I've used Gravity forms and done exports and imports without any problems. I guess I must just be lucky so far. ;)

    To get onto your problem though... You will need to use another tool for this. The two that come to my mind straight off are the *nix command line or MySQL's Workbench software. The command line is probably the eaiserst. You can log into the mySQL server and create a full dump of the database into a .sql file and them import that file back into another database. if it's phpMyAdmin that's the problem, you'll get around it by doing this. This is the first reference that I could find ot it, so not sure about the quality of it. But overall, it's correct. Just a few commands and you'll be done.

  7. Knut Sparhell
    Member
    Posted 2 years ago #

    PhpMyadmin handles serialized data perfectly, in export and on import. They are strings, and may be unserialized as long as they are not tampered with.

    The problem is probably the search and replace method you are using. Do not, not ever, in any case, replace strings inside a string that contains serialized data. Restrict it to the columns or meta_values you really need to change, and that are not serialized.

    So, you must keep those values as they are. The metadata contains the actual web form for "Contact Form 7". If something in there needs to be updated, do it manually from the Contact Form 7 editor. If many, too many to do it manually, try to find a tool that let you manipulate serialized data, or write a script in PHP that deserializes, replaces, and serializes again.

    Or, this plugin, might do it for you (not tested).

  8. michael.mariart
    Member
    Posted 2 years ago #

    OK, I didn't see this bit at the start...

    When the domain is changing I do a find and replace on the database sql file

    You CANNOT do a standard find-and-replace on serialized data fields. The problem is that serilaised values in PHP store the data's length as well as the data, so changing a URL from 'http://example.com' to 'http://www.example.com' will break everything because the strings are two different lengths.

    When these values are inside an array and serialised, they are stored as:

    a:1:{i:0;s:18:"http://example.com";}

    and

    a:1:{i:0;s:22:"http://www.example.com";}

    As you can see, there's more different then just the domain name. When you move into the sort of multi-dimensional arrays that are stored by the plugins that you are using, there's a whole lot more that can go wrong very eaily.

    The plugin mentioned by Knut will probably work, but I haven't tested that before either. One tool I know works because I use it all of the time is this:

    http://interconnectit.com/124/search-and-replace-for-wordpress-databases/

    Just run it on your new WordPress install and it will do this the correct way.

    And as a parting reminder - Do not edit your sql file! That's doing it the wrong way and will not work.

  9. vtxyzzy
    Member
    Posted 2 years ago #

    I use the WP Migrate DB plugin to make the changes and export the DB. Works well for me.

  10. audiobreather
    Member
    Posted 1 year ago #

    I registered only to say Thank you :)

    @michael.mariart Thank you very very much!
    Your answer was very helpful and it solved my same problem in Gravity forms.

    Thank you thank you thank you! :)

Topic Closed

This topic has been closed to new replies.

About this Topic