Use at your own risk and always backup your data
The site moved to a new server today and I had to scramble a little, I thought they would just increase my disk space not put me on a new server. I was able to grab Kay’s mail, backup the WordPress database and site files before the dns propagated. Putting files back in place would be easy but I wasn’t sure about restoring the database. The main reason was they gave me a different admin login which means the database would be owned by a different user and table prefixes would change. But as always there should be a way, and there was.
I had to do something similar years ago for some reason I don’t remember so I set out to do a little searching. First stop was the Word Press page for moving a site. That led me to restoring your database from a backup and then on to something with pictures.
I followed the directions but had to add my own twist since the new database would be named different than the old one. Unfortunately that was out of my control.
- Again that was due to the provider giving me a different admin login than what I had for the old server.
Since I had backups of my database, specifically a .sql backup, I opened it in a text editor (gedit) to review. I didn’t have to look hard to see anywhere I saw the old name I could replace it with the new one. After making a copy of the original, always make a copy, I did a simple Search Replace and save. Following the instructions I then “dropped” the existing database … but there was nothing it is since is was fresh from an install so no harm no foul, then imported the .sql file using phpMyAdmin. There I ran into a small problem. The .sql file had a statement in it to create a database, but in my case it already existed. Easy enough, comment out the CREATE.
/*CREATE DATABASE `<database name>` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `<database name>`; */
With that out of the way import again and success !! I go to the site and all is well, nice. The internet does it again, a wealth of information at your finger tips…. and a little bit of logic.
Note: Standard changes to wp-config.php apply, if necessary. Since I dropped the database created on the new server and imported my old one my password did not change.