Split SQL files

Sometimes you might have to move a web site from one to another hosting. This process always involves making a database back-up and importing it into the new hosting. SQL file can reach sizes far bigger than 60mb if we talk about websites that have been around for a while. It’s almost impossible to open such a file in text editor and do some find and replace commands. A good way to fix this is to use SQL Dump File Splitter for Windows.

This small program will help you split a big SQL file into smaller and give you control to how much MB should they be on avarege. Then editing each single file is no problem at all. A README file, will instruct you about the order of import you need to use, as one of the splits, holds all the tables’ structure and nothing else.

If you want to edit your SQL just because the urls in it are wrong, than you can use two other solutions, which are much easier

Install Velvet Blues Update URLs. This plugin will let you define old and new urls, and after a click of a button it will update them. Be aware – it works only for the content of the posts.

You can use phpMyAdmin, to do all those manipulations after database migration, if you are clever enough and not afraid to mess up directly into the DB.

To change the urls of content:

UPDATE wp_posts 
SET post_content = REPLACE (
	post_content, 'http://www.oldsiteurl.com',
	'http://www.newsiteurl.com');

To change the posts’ guid filed:

UPDATE wp_posts
SET guid = REPLACE (
	guid, 'http://www.oldsiteurl.com',
	'http://www.newsiteurl.com');

1 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *