I’m working on a WordPress project and I have my WordPress folder inside a git repo, so the files are identical on my PC and laptop.
I tried to export the “wordpress” database from my PC and on my laptop dropped all tables from the “wordpress” database and imported the .SQL. So that should mean the databases are identical as well.
But now I’m getting “This webpage is not available” (Error code: ERR_CONNECTION_REFUSED) in Chrome.
Any ideas?
Yes, the databases are identical, which is likely the problem WordPress keeps a lot of URLs in the database, including the main URL for the site.
Your site is probably trying to redirect to an address of localhost or similar on your PC, which, of course, it can’t.
If you are going to do this with a WordPress database, you need to change at least the URLs in the wp_options table. You can edit the database with something like PHPMyAdmin.
That will probably get your site running, but all of the images will point to the old URLs and so forth. To cover everything, I sometimes use a quick approach like:
The only issue is that not everything gets properly converted. WordPress uses quite a few serialized strings in the options table (e.g for widgets), so when you just replace part of them the lengths are wrong the the serialized string no longer works.
Based on my experience, I always use the following plugin:
WP Migrate DB
It’s very simple to use and you’ll be able to export your database without having to manipulate anything. The plugin automatically updates the URLs depending on the parameters you define before starting the export process.
I really appreciate this tool and use it for every migration/deployment, you should give it a try. It’s completely free and after a lot of migrations I never had any problems.
Let me know if it helps you.