![]() ![]() There are 2 brilliant tools that can handle serialized data and do a search and replace on the old and new databases for the URL and leave serialized data intact. Sometimes issues may arise with a problem called serialized data which is when an array of PHP data is somewhat like encrypted with the actual URL, so if the URL is changed the data is gone. Mysql> UPDATE wp_postmeta SET meta_value = replace(meta_value,'','') gįinally update your WordPress config file to reflect the new database, wp-config.php” which should be in your web document root – change, databasename, username, password and host values: define('DB_NAME', 'databasename') ĭjave has created a nice and easy script that takes the old and new URLs and hands you the SQL code for the WordPress swap, nice! Serialized Data Mysql> UPDATE wp_posts SET post_content = replace(post_content, '', '') Mysql> UPDATE wp_posts SET guid = replace(guid, '','') Mysql> UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl' Type 'c' to clear the current input statement. Other names may be trademarks of their respective Oracle is a registered trademark of Oracle Corporation and/or itsĪffiliates. ![]() Server version: 5.5.13 MySQL Community Server (GPL)Ĭopyright (c) 2000, 2010, Oracle and/or its affiliates. You can turn off this feature to get a quicker startup with -A Reading table information for completion of table and column names Or via command line: mysql -u root -p databasename UPDATE wp_postmeta SET meta_value = replace(meta_value,'','') UPDATE wp_posts SET post_content = replace(post_content, '', '') UPDATE wp_posts SET guid = replace(guid, '','') Also if necessary change the table prefix values where applicable (ie wp_ ) UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl' Use the code as below and swap in your old and new URLs, no trailing slashes. Make sure you have the new database selected, then run some SQL updates and replacement commands on the tables notably, wp_options, wp_posts, wp_postmeta. WordPress Database Switcherooįirst, do a MySQL database export of the old database on the old server, create a new blank database on the new server, import the old data either in PHPMyAdmin or mysql directly in the command line. If you are not comfortable with interacting directly with the MySQL database I suggest you check out and use the popular and robust WP Migrate Pro – otherwise read on. This method just uses the whole MySQL database rather than a WordPress export/import from within and is best suited for a straight swap. So you would copy all the WordPress files/folders to the new destination, set the correct ownership to those files, then do the database switcheroo. After migrating a WordPress site to a new URL either to a live production site or a testing development server, the new URL strings in the MySQL database need to be changed and updated in the various MySQL database tables. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |