Today’s entry in the “Diary of a budding web developer“.
This is a recording of my first experience in migrating a wordpress website and back-end mysql database. My partner does this kind of thing all of the time in applications on other levels, but this was my first time. I thought it would be worth the mention to post it here as some may find my spin on things useful. I actually did it with two installs, and will be repeating the same process with a different server.
I wanted to have an active running site working while I was doing the migration procedure as to make sure everything ran smoothly. I also wanted to move one install up a level, ie: from mydomain.com/blog to mydomain.com. The benefits I found in doing things this way are listed in the notes at the bottom.

Get your files:
1. Download entire wordpress directory from control panel’s file manager. I used file manager as to get a compressed version which saves time.
2. Go to phpmyadmin in current site’s host and export mysql database.
- If one isn’t sure which database goes to the corresponding install, they can look at wp-config.php for ‘DB_NAME’.
- Make sure to check which version of mysql the database is using. You can access this by clicking on the “home” icon.
- Select Database
- Check or select all tables
- Export database in compressed file format of choice
(My first try bailed as I did not check SQL 4.0 compatibility mode. I needed to do this as the first DB I moved was using 4.0.)
Upload Files to Server:
My server has a top level domain in which all other folders/domains are subfolders under. I created a subfolder for the new installation, ie: mytopleveldomain.com/mywpinstall.com.
3. Create subfolder for files to go in
- Upload compressed file to “mywpinstall.com” folder via ftp or file manager. (this may take some time, so you can skip to the next step)
- Go to hosting control panel’s file manager and extract files
- Drill down into the extracted folder, select all and move up a level
- Delete empty folder and also delete the compressed file as you don’t want this data vulnerable to the world.
Find & Replace:
This step involves changing the address paths in your database file using text editor of choice. I ended up using both Geany and gedit with additional plugins as I run linux as my operating system. The first run that I did involved changing the path from mywpinstall.com/blog to mytopleveldomain.com/mywpinstall.com
4. Find & replace files in .sql file.
- Extract compressed .sql file
- Do a find and replace, which changes what you find to what you want to replace it with. ie: mywpinstall.com/blog to mytopleveldomain.com/mywpinstall.com
- You may want to check the server path as well, ie: /home/www/ may need to be changed to /public_html/
- Save changes
Create a New Database:
5. Go to your new host’s control panel mysql area and create a new database
- Make note of new database name and prefix
- Create a user for the database assigning all permissions
- Assign user to the database
- Make note of new username, prefix and password
Upload .SQL file
6. Go to phpmyadmin & select database
- Import & browse for your .sql file
- Select dropdown for compatibility mode if required
Change wp-config.php
7. Download wp-config.php and open it with text editor of choice. (I like Gedit, and it can be installed for windows as well)
- Change DB_NAME to new
- Change DB_USER to new
- Change DB_PASSWORD to new
- Change DB_HOST if needed (I had to change mine to localhost)
Custom Structure Reset
8. The next step if you have used custom structure
- Go to control panel of your site with subdirectory path, ie: mytopleveldomain.com/mywpinstall.com/wp-admin.php
- Settings>permalinks>copy custom structure to your clipboard
- Check default settings radio button and save
- Check custom structure radio button
- Paste your clipboard contents and save
Notes: On my second wordpress migration, half of the widgets were gone. I was glad to have the ability to go to the original site as to copy and paste the widget code on the new install. The last thing that I need to do is move the domains and also reroute the DNS. When that’s finished, I will be able to point the domain to the subfolder. When the DNS is set, I can then delete top level directory from the path in the Admin>Settings>General area.
This gives one the ability to fully test a migration before it is in operation and also change the directory structure. If you don’t have a top level domain in your hosting account, I highly recommend it, as I have found it useful for other projects.





















