I have a full backup of my WP site that I made in Filezilla and I also have a copy of the database that I exported using phpmyadmin.
I just moved the domain to a new host and I want to restore the website to how it was.
Is it as simple as just reuploading all the files in Filezilla to the new host?
Also, I tried to import my copied database in phpmyadmin and got an error that says database does not exist. Well obviously it doesn’t exist, that’s why I’m trying to import it! Do I have to create one with the same name first?
Ok I did those things and now it says "error establishing database connection."
My old database was called OLDHOST_wrdp1.sql.
When I created the database at the new host it’s called NEWHOST_wrdp1.sql.
Do I need to rename the database to the old thing or change every reference of it to the new one?
I changed the references to the new database name in wp-config.php but I still get "Error establishing database connection."
When I try to load wp-admin, I get this message:
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.
|
Why would the username and password have changed from before? I copied everything over directly from my last backup so all the usernames and passwords should be the same. If not, how do I know what it’s supposed to be?
Ok I figured it out. I’m going to put all the steps here so I remember next time.
1) Create a new database in MySQL Databases. Name it the same thing as your old one, except the prefix will probably be different and I don’t know how to change that.
2) In an FTP program, copy the public_html folder from your saved copy to your new hosting location. This will include all the WP folders and stuff.
3) In cPanel MySQL Databases you have to create a new user and password for the database. So name the username whatever you want and make a password and click "Create User."
4) Then you have to add this user to the database, so choose the user you just created and select the database you created in step 1 and choose "Add." Then you’ll be taken to a page where you select permissions. I chose "all." Then click "Ok."
5) Then you have to go into wp-config.php and change the database name, username, and password to the things you just created. I would assume you wouldn’t have to do this step because you copied over files that already had this information present but I guess that stuff didn’t copy, so find these lines and change them:
define(‘DB_NAME’, ‘newprefix_databasename you created in step 1‘);
/** MySQL database username */
define(‘DB_USER’, ‘newprefix_username-you-created-in-step-3‘);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘password that you created in step 3‘);
Save your changes and reload your website and it should work. You should be able to log into wp-admin with the same username and password as before.
Also, if updating the domain you’ll need to update two values in the wp_options table, which are:
siteurl
home
Those are the "option_name" and will contain the values for the first site they were installed on. Just update them to your new site and you should be set. You’ll notice this if you try to visit pages other than the homepage and get an error.
Also, if updating the domain you’ll need to update two values in the wp_options table, which are:
siteurl Those are the "option_name" and will contain the values for the first site they were installed on. Just update them to your new site and you should be set. You’ll notice this if you try to visit pages other than the homepage and get an error. |
Oh, I’m glad you posted that cuz I’m about to do just that (change the domain and move the content from the old site to the new one).
2) In an FTP program, copy the public_html folder from your saved copy to your new hosting location. This will include all the WP folders and stuff.
|
this is only a good idea if you are hosting one domain, and wanting to transfer that, if you have multiple domain names and only want to transfer one site then, otherwise you are transferring a ton of files that you will not need. If you host multiple sites and want to transfer one, then copy the folder with the domain name
and really you only need to do this is if you modified the site using the editor in admin account or in a text editor, otherwise if the template is exactly how you downloaded it, there is no need to do this and just reup the template you downloaded
What folder should one copy over? Just the WP ones?
Also, if updating the domain you’ll need to update two values in the wp_options table, which are:
siteurl Those are the "option_name" and will contain the values for the first site they were installed on. Just update them to your new site and you should be set. You’ll notice this if you try to visit pages other than the homepage and get an error. |
I just had to do this. I created a new domain to replace a previous domain on the same host with the same db.