• Resolved youthman

    (@youthman)


    I need to move a wordpress site to a new server. I created a subfolder on the current server and uploaded a fresh copy of WordPress into it, created a new database on a DIFFERENT WEBHOST and updated the config.php file with the database info from the NEW database. When I try and connect to https://www.mysite.com/subfolder/wp-admin/install.php, I get a “Could not connect to database” error.

    My question is it possible to have the files on one serve and linking to a database on a different server?

Viewing 9 replies - 1 through 9 (of 9 total)
  • It is possible, but by default most MySQL servers will block any outside connection requests. You’ll need to look at your hosting servers control panel to see what is allowed and what’s blocked. If there doesn’t look like there’s anything that stands out contact your hosting company and ask them for help with the firewall.

    Thread Starter youthman

    (@youthman)

    I have deleted the database and created a new one and updated the wp-config.php file with the new database and still cannot connect. I’m guessing this cannot be done. Can someone confirm this?

    Thread Starter youthman

    (@youthman)

    Thanks cata. I’ll give them a call to see if that is what is happening.

    Thread Starter youthman

    (@youthman)

    Cata, you were correct. It is possible….but I would have to be on a Dedicated Server and I am currently using Shared Hosting. Looks like I’ve hit another brick wall in this process. Should I start another threat with the specifics of my situation to solicit advice on how best to migrate the website from one server to the another?

    Moving the site can be done with these instructions. There’s really no difference between moving to a shares service or a dedicated service as the same steps are involved.

    I’m not sure that I’d agree with having to move to a dedicated server… most shared server accounts that I’ve seen before can allow remote connections (cPanel has that option built-in by default), but I guess it depends on how the hosting company has the server set up.

    Thread Starter youthman

    (@youthman)

    Unfortunately, 1and1 hosting does not use cPanel.

    I’ve read through countless threads as well as the link you provided to make sure I understand how the process works. My issue is downtime.

    The current site has a virus in the site that is creating files and folders on the server. I found this out because I downloaded the entire website and uploaded to my 1and1 server and 1and1 immediately notified me that there was a virus and temporarily disabled the FTP access.

    My plan was to create a subfolder on the current server and rebuild the site with a fresh install of wordpress but create the database at 1and1. Once the site was working properly, then I can request the domain transferred to 1and1 and there would be zero down time.

    Any suggestions?

    What’s worse… Downtime, or having an infected site? For me, a site that’s down is one that’s better than one that’s serving up hacked content, and possibly virus’s to my visitors.

    Also, just remember that if the vunerability that’s been exploited is somewhere in the code, then moving servers won’t help, and they’ll just hack in and do the same thing again.

    If it was me, I wouldn’t worry about having a remote database when you’re re-building. Transferring the database along with the websites files is a pretty easy thing to do, and can be done in any down-time while you’re FTP’ing files around the place. I’d actually recommend that if you’re going to re-build anyway, just re-build the site on the new hosting server along with a new database and then there’s no concerns about database connections, remote access, transferring sites, etc.

    Thread Starter youthman

    (@youthman)

    You have a good point.

    The virus has to do with the twitter feed from the theme.

    My initial plan was to purchase the latest version of the theme, create a fresh install (not just copy files from one server to another) and create a new database on the new server.

    It looks like moving the website will require downtime of the website because I cannot setup the wordpress database until the dns servers are pointed to the 1and1 (the new webhost) since 1and1 shared hosting uses dynamic IP addresses.

    Thread Starter youthman

    (@youthman)

    I ended up calling the hosting company and they said the reason the database kept erroring out was because of it’s size (6mb zipped, 60mb unzipped). They had to import the database through SSH and that worked. Now I just have some cleanup to do. Thanks again Tara for your help and advice.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Cannot connect to database on different server’ is closed to new replies.