How do I move my 3.0 database to my 4.0 account?
Moving your database from your WestHost 3.0 account to your 4.0 account is really pretty simple. First there are a couple things you need to know about MySQL on your 4.0 account that is different from 3.0. Since 4.0 is a shared environment and not a VPS like 3.0 it means we don't have our own installation of MySQL. That means that both usernames and databases need to be prefixed with your 4.0 username. Luckily cPanel knows this and takes care of that when you create both your database and the users for it. I am going to use Wordpress as an example here.
The first thing you need to do is Export or save your database tables for Wordpress from your 3.0 account to your local computer. If you don't already have phpMyAdmin installed on your 3.0 account then log into Site Manager and install it. Once it is installed you should be able to log into phpMyAdmin at http://example.com/pma. The username and password is the same as the one you use for Site Manager.
Once you log in to phpMyAdmin look for the Wordpress database in the left column. If you installed it via the WestHost Site Manager then it well be called wordpress. Click on the database then on the Export tab. On the next page you can leave everything at the top of the page set to the defaults. All the tables for wordpress should be selected or grayed out in the upper left by default which is what we want. If you scroll down the page you are going to see a tick box for Save as file that you want to make sure and check/select. Then below that you want to choose gzipped as the Compression. This is important since your 4.0 account only excepts and recognizes that compression format. Click the Go button and you'll be prompted for a location on your local computer where you want to save the file. If you left the defaults it well save the file as wordpress.sql.gz. Depending on the size of your database this could take some time.
Sometimes a database is too large and well fail when you try to export it. If that happens then you would need to save it it sections. To do that you would need to select the tables you want to export at the top of the page before you hit the Go button. Try splitting the export into two files first. Select the first half of the tables and export them. Then select the second half of the tables and export them. If you do this you'll need to alter the name of the two files. The first could be left as the default wordpress.sql but then you would want to label the second one as wordpress2.sql. You can do this when the window pops up for you to choose the location or you could manipulate the File name template that is at the bottom of the window in the phpMyAdmin export page. You would not need to remember the template in this case.
Now that you have the database backed up and saved on your local computer you need to log into your cPanel for your 4.0 account. Once logged in use the MySQL Database Wizard to create a new database and user that you are going to import your data to. The wizard is pretty self explanatory and can be accessed either via the icons in the top left box when you log into cPanel or you can scroll down the right side to Databases. One of the last steps in the wizard ask you about privileges. You want to give full privileges to the user. Don't forget to make note of your username and password. You'll notice also that cPanel has prefaced both the database name and the username for the database with your username for your account.
Now back in cPanel we can scroll down the right hand column and under Databases you'll see the link to phpMyAdmin. Unlike in your 3.0 account you don't have to install it. It is a shared version of phpMyAdmin so it is already there. Simply click the link and if prompted log in to phpMyAdmin. You'll see the database that you just created via the wizard and you want to select it. Then click on the Import tab. On the next page you simply Browse for the file that you saved on your local computer and then click the Go button. It may take some time to process the file but once it does you'll be finished with transferring your database to your new 4.0 account!
I mentioned that I would use Wordpress as an example. While the above is all it takes to move your database from 3.0 to 4.0, if you are moving something like a Wordpress installation you need to take some steps to make sure that your configuration is set up for the changes in environments. Even if you picked the same database name, user and password when you created your 4.0 account they are now prefixed with your base username. So you need to change those settings in your wp-config.php file. These setting should be right at the top of the file and can be changed using a plain text editor like EditPlus.
The other thing that you may need to look at depending on your situation would be the wp_options table in your database. Fire up phpMyAdmin again and click on the wp_options table once you get to your wordpress database. Under the option_value column look for input that may be related to your old 3.0 account. Examples of this could be a full path to a directory where images are saved. You might see /var/www/html/wordpress/images that would need to be changed to /home/[username]/public_html/wordpress/images. Something else you might have done when you move is to change the location of your wordpress installation. I know one user decided to move it to the public root of /home/[username]/public_html instead of /var/www/html/wordpress. I know of two option_names that would need to change in this case. siteurl and home would have to change since they would look something like http://example.com/wordpress. Just be award and check all your wp_options. Don't forget there is more then one page of results for this table. You have a Page number drop down you can use at the top and bottom of the phpMyAdmin page you can use to browse through them. I know that the home option I mentioned above is on the second page or results.
Outline Of Process
Export Database From 3.0 Account
- Install phpMyAdmin on account. If already installed skip to step 2.
- Log into Site Manager at http://example.com/manager.
- Go to Site Applications > Install & Manage
- Click the install icon next to phpMyAdmin under Database and follow instructions in the pop up window.
- Log into phpMyAdmin at http://example.com/pma.
- Click the wordpress database from the left column.
- Click the Export tab.
- Leave the defaults under Export and Options as they are.
- At the bottom of the page select Save as file
- For Compression select gzipped.
- Click the Go button.
- Select the location on your local computer where you want to save the file.
- The file well be saved as wordpress.sql.gz.
Possible Optional Steps Needed
If your database is too large and times out on export return to step 4 and change defaults as follows.
- Under Export select the first half of the tables in the database. On a default installation this would be wp_comments, wp_links, wp_options, wp_postmeta and wp_post.
- Leave the rest of the defaults as is.
- Continue with steps 6-10 from above.
- Once you have completed this first export return again to step 4.
- This time under Export select the second half of your tables. On a default installation this would be wp_terms, wp_term_relationships, wp_term_taxonomy, wp_usermeta, wp_users.
- Leave the rest of the defaults as is and continue to steps 6-10 except for File name template under Save as file. Replace __DB__ with wordpress2.
- This time the file well be saved as wordpress2.sql.gz.
Importing Database To 4.0 Account
- Log into cPanel via cp.westhost.com. WestHost has it's own control panel that allows you access to cPanel. Please refer to your welcome email from WestHost for specifics.
- Click the MySQL Database Wizard icon in upper left corner or use the link on right under Databases.
- Follow the prompts given for creating a new database and user for that database.
- Enter wordpress for the database name and any choice you want for username. These well both be prefixed with your main username by cPanel.
- On the last step it ask you what permissions you want the user to have. Give the user full permissions to the database.
- Make note of the password you assign this user.
- Return to the home page of cPanel.
- On the right under Database click on phpMyAdmin.
- If prompted supply your main username and password for your 4.0 account.
- Click the [username]_wordpress database from the left column.
- Click the Import tab.
- Click the Browse button and navigate to wordpress.sql.gz file that you saved on your local computer.
- Click the Go button.
- The resulting process may take some time but you have now transferred your database!