Moving WordPress database with WP Migrate DB
With the WP Migrate DB plugin you can move your WordPress database in just a few steps and migrate all your content to another website. The plugin is particularly suitable for developers to exchange data between staging and live websites.
WP Migrate DB exports your database as a MySQL dump, finds and replaces all urls and file paths and then allows you to save the database as a SQL file on the computer. To complete the migration, you can then import the SQL file with e.g. phpMyAdmin on the target website to replace the existing database there.
WP Migrate DB
You can find the basic version of the plugin for free in the WordPress plugin directory. There is also a Pro version with more features, but more on that later. WP Migrate DB comes from the Delicious Brains developer studio and is currently active on 300,000 websites.
In contrast to the WordPress importer contained in the core, it allows the migration of the entire WordPress database , ie not only your content such as posts and static pages, but also all core, theme and plugin options are included.
Export WordPress database
You can find the settings of the plugin under Tools → Migrate DB in your WordPress backend. The main function Export File is already selected and allows you to download a compressed gzip file from your database.
In addition to exporting an SQL file, the free version also lets you search and replace content in the website's database. For this task I would recommend the Search & Replace plug-in because of the better feature set.
In the options for Find & Replace you can have the URL of your website and, if necessary, the file path of the wp-content directory replaced automatically when exporting. Most of the time, the URL is enough for the target website. In the Advanced Options you can exclude certain content such as spam comments, revisions and transients from the export.
Finally, there is still the option to save your settings as a migration profile. This allows you to perform the same migration again at a later point in time without having to reconfigure. With a click on Export & Save the export is carried out and the SQL file is offered for download after completion.
In contrast to a database backup with a WordPress backup plugin or a MySQL dump with phpMyAdmin, the exported SQL file from WP Migrate DB is directly prepared for import because all URLs and file paths have already been adapted and changed for the target website .
Move WordPress database with SQL import
As a final step, you can now import the exported SQL file onto the target website. In most cases you should have access to a database management tool that allows you to import the database using a web interface.
Web hosting providers usually give you access to the database with tools like Adminer or phpMyAdmin. From there, the SQL file can be imported.
WP Migrate DB's SQL file contains DROP TABLE commands, ie your existing WordPress tables will be completely deleted and replaced by the newly imported tables. As always with such critical activities, I strongly recommend that you ensure sufficient backups of all data in advance - just in case.
More features with WP Migrate DB Pro
There is also a Pro version for the free WordPress plugin, which offers a range of add-ons and additional features.
Among other things, it is also possible to import exported SQL files, so that external tools such as phpMyAdmin are superfluous and you can do everything directly in the WordPress backend. The push and pull functions also enable easy synchronization of the staging and live server without having to deal with SQL files.
The WP Migrate DB Pro add-ons enable the synchronization of theme, plugin and media files between two WordPress installations, better support for WordPress multisites and integration with WP-CLI , the WordPress command line tool.
Conclusion
I rarely use WP Migrate DB , but it always worked great when I needed to migrate the database. The plugin is characterized by its focus on a specific purpose and very good usability. And the most important thing: It runs reliably without crashing and has no problems with complex and large databases.
Hello Brian,
thanks for the interesting contribution. Now I am curious, what do you use for a move (you write that you rarely use WP Migrate DB)?
So far, I've usually had a database backup and import (via phpMyAdmin) and then the "Database Search and Replace Script in PHP" ( https://interconnectit.com/124/search-and-replace-for-wordpress-databases/ ) solved.
But I'll try WP Migrate DB.
many Greetings
Susanne
Hello Susanne,
I rarely use the plugin because I rarely need to move the WordPress database 😉
Otherwise, I also use tools from the web host directly. Nowadays more and more providers offer extra solutions for staging websites.
Many Greetings,
Brian
Hello Brian,
thank you, I was hoping you might still have the ultimate tool up your sleeve 😉
many Greetings
Susanne
I've already done it like Susanne or with WP-Migrate DB. Now I want to transfer the data (posts and pictures) from an old blog to my new blog. However, it already contains many contributions. I don't want to lose that, of course. Can I do that with WP Migrate DB or which method would be appropriate? Simply exporting via XML is not possible because then I would be missing the photos. Thanks.
WP Migrate DB is less suitable because it migrates the entire database of the WordPress installation, ie including user data, options, etc. During the migration, the existing database is also replaced.
In your case, the database of the new blog should be retained and only a few old posts should be imported. I would actually use the normal WordPress importer for this. It offers the option of importing the media files as well.
When exporting, only the contribution data is saved as XML, without images. When importing, the new blog then uses the URLs to get the images from the old website. This still needs to be publicly available so that the image URLs can be accessed.
Hope that helps you 🙂
Many Greetings,
Brian
Thanks Brian. So I can't turn it off because the URL has to be publicly accessible. Then I create double content - right? Can I switch off the domain and still keep the images publicly available? Perhaps via .htaccess or with one of these plugins that enable maintenance mode? HG
Sorry, I described it in a somewhat incomprehensible manner. The old blog only needs to be accessible during the import process so that the images can be fetched from there. The images are downloaded from the old website and saved directly in the media library of the new blog, so they are then available there as normal.
After the import, the old website can be switched off, or even better, a 301 redirect to the new website.
Many Greetings,
Brian
I've already seen it. Thanks Brian. Has it always been the case that after the import process, the images are quasi "fetched over"? I felt as if it hadn't been the case before and only the texts were available after the process. Maybe I forgot to download the media? No matter. Anyway, it worked thanks to your help.
Yes, the media import feature has been around for a few years in my opinion. But don't know exactly since when 🙂
Hi! Nice tutorial, really very comfortable plugin for a quick domain move.
For people who prefer to move a domain or a server without a plugin, there is another tool. Here's a little tutorial from me: https://webdeasy.de/wordpress-seite-umzüge-ohne-plugin/
many Greetings
LH
Dear brian,
thank you for your great tips always. I am always the silent reader here with you. You are my hero 🙂
I have a question, what is the name of the plugin with which you present the plugins here with the number of downloads, last update?
I've had it before, but can't find it anymore and unfortunately don't remember the name either.
Greetings and thanks in advance
Hello Jörg,
Thank you very much for reading and the great feedback 🙂
I use plugin cards for this: https://de.wordpress.org/plugins/plugin-cards/
There is a post about the plugin at https://themekiller.me/2016/09/19/plugin-informationen-von-wordpress-org-mit-plugin-cards-einfach-einbinden/
Best regards,
Brian
Once again to understand: The plugin only exports the database and not the files / images etc. from the upload folder, the theme & plugin files etc.? Do you have to move them manually via FTP?
Yes exactly. In general, it is more of a tool for developers to quickly synchronize the database between the website and staging / localhost. Moving the entire website including files requires some manual effort, other tools are probably better suited here.