A
A
Andrew2020-02-17 15:36:58
WordPress
Andrew, 2020-02-17 15:36:58

How to copy the database correctly?

tell me how to correctly copy the database from the main domain to the domain for dev
, that is, the main site is located on www.domen.com and the version for dev will be www.dev.domen.com
So that all links in the database are replaced.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lord_Dantes, 2020-02-17
@Lord_Dantes

Export DB1 domen.com > Import DB1 domen.com into DB2 for dev.domen.com
Next, go to DB2 item SQL and paste this code:

UPDATE wp_options SET option_value = REPLACE(option_value, 'http://domen.com', 'http://dev.domen.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE(guid, 'http://domen.com', 'http://dev.domen.com');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://domen.com', 'http://dev.domen.com');

In the code, we update the links of the past domain to the new one, on the left is the previous domain (specify the correct certificate), on the right is the new one (specify the correct certificate) and that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question