Manual Changes required when Restoring a Database to another WordPress Installation

For testing purposes, I restored the WordPress database of this blog to my development WordPress instance.

When I tried to open the login page, the browser told me it was not able to establish a connection to the server at localhost (WordPress dev instance is running on localhost).

Looking at the php_error.log I found the message
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 11173888 bytes).

wpbeginner suggests to add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php. I did so, but no change.

Then I recalled from moving this blog to another site, that it is required to change two URL values in the settings. Well, not being able to login takes away the option to use the UI.

Fortunately, these settings are stored in the database, to be more precisely, in the table wp_options.

Entering the following statement, I found (beside others) the two relevant records I had to change:

select * from wp_options where option_value like '%instance-factory%';

In case you want to do the same against your database, you have to replace instance-factory with the corresponding URL fragment of your blog.

The option-name values siteurl and home keep the these settings. Running the statements

update wp_options set option_value = 'http://localhost/wordpress' where option_id = <option_id siteurl> and option_name = 'siteurl';

update wp_options set option_value = 'http://localhost/wordpress' where option_id = <option_id home> and option_name = 'home';

changed the values and I was able to login to the local instance.

When the setup of your target WordPress installation is different, you have to replace http://localhost/wordpress with the appropriate URL.

It turned out that define( 'WP_MEMORY_LIMIT', '256M' ); was not needed, so I removed it from wp-config.php.

Links

Fix: WordPress Memory Exhausted Error – Increase PHP Memory
Moving this WordPress Blog to HTTPS URL in a Single Action

Leave a Comment

Please note that every comment requires the admin's approval before it will be published.

Any comment containing spam like "... great topic. Feel free to visit my web page ..." will be deleted. So please do not waste your and our time by leaving such comments.

We respect your privacy. When you leave a comment, your IP address will not be recorded by WordPress.