Update WordPress posts after site Move

Updating MySQL wp_posts to new URL or folder

When moving your WordPress site to a new folder or domain name, there is a little more you need to do than change the permalink structure and adding 301 into your .htaccess.

After performing the above steps you will need to make some database search and replace changes to get your data references 100% correct.

Change all references using old site URL:

UPDATE wp_posts SET guid = replace(guid, 'https://www.oldsite.co.uk/oldfolder','https://www.newsite.co.uk/newfolder');
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldsite.co.uk/oldfolder','https://www.newsite.co.uk/newfolder');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldsite.co.uk/oldfolder','https://www.newsite.co.uk/newfolder');

If you installed SSL, an additional search / replace is required:

UPDATE wp_posts SET post_content = replace(post_content, 'https://www.oldsite.co.uk/oldfolder','https://www.newsite.co.uk/newfolder');

Change all references using old folder name:

UPDATE wp_posts SET post_content = replace(post_content, '/oldfolder/','/newfolder/');

Solution: ERROR 2006 (HY000) at line XXXXX: MySQL server has gone away

Getting MYSQL server has gone away when importing database from .sql file

Problem: You are trying to import a .sql file using the command line mysql command but it is unsuccessful as follows:

# mysql -u douser -pdbpass yourdb < db_file.sql
ERROR 2006 (HY000) at line XXXXX: MySQL server has gone away

The solution is to edit /etc/my.cnf and add the following line to the [mysqld] section:

max_allowed_packet=64M

Then restart mysql:

# service mysqld restart

Re-run your import query (you may need to delete the partly database first and re-create it) and it will now succeed.

How to change phpMyAdmin post_max_size to more than 2MB

Re: Unable to increase upload limit for phpMyAdmin in Plesk

To change the post_max_size in Plesk it is not as simple as changing the /etc/php.ini file entries as there are not active when running phpMyAdmin from within with Plesk Control Panel.

Usually, on a regular *nix installation you would look for these values in /etc/php.ini

  • phpMyAdmin logoupload_max_filesize
  • phpMyAdmin logo

What you need to change in fact is this file:

# vi  /usr/local/psa/admin/conf/php.ini

change:

  • upload_max_filesize = 2147483647
  • post_max_size = 2147483647

to:

  • upload_max_filesize = 32M
  • post_max_size = 32M

This value will now allow phpMyAdmin uploads of files up to 32M is size. Enter your own value here.

Database required (mysql, version >= 5.0) (not available, please check domain or client limits)

Re: Can’t install Wordpres, Joomal or other Database Application

The error message “Database required (mysql, version >= 5.0) (not available, please check domain or client limits)” is usually returned when there are no spare databases left to install the application.

To resolve, try the following:

  • 1) Within Plesk, Database, delete any unwanted databases to free up your allocation
  • 2) Upgrade your Hosting account so that you have a greater database allocation