Migrating WP site from Sitegrounds to Infinity Free - database connection error



Error establishing a database connection

Hi, I think I have done everything correctly I pointed the nameservers from my previous host to the ones InfinityFree gave me. I uploaded SQL and PHP. I added the files to my file manager. I installed WP using Softalicious. I just don’t know how to link the database to the actual page. It’s a very small website. I followed the guidance here How to migrate your website to InfinityFree - but I got really confused on step 4. I don’t know where I “open the database” (is it SQL, file manager?) to find the config file.

Also, one thing that seems strange to me is that on my Infinity Free account page under “My SQL Details” (before clicking into the Cpanel), it has a different database name than the SQL database that I uploaded and renamed, but I do not know how to edit that. I don’t know if that’s why they don’t match up… I’ve had my web design guy take a look and he doesn’t know what to do either.

Would appreciate some help, thank you!


Open the online file manager, then follow this article starting at step #2.

Your database details can be found my clicking “MySQL Databases” in the control panel.


If you’re migrating an existing website, I would not recommend to install a fresh copy with Softaculous. Instead, you can just migrate the entire installation as-is. That’s the recommended approach both by us and by WordPress.


Thank you! So, weird things happen. I have uploaded the files backed up from my previous host to the FTP, I opened and edited the config file. I saved, opened the website from a browser and now it just says “index of /” and doesn’t display my site. I came back today to check how things are going, and in the FTP I couldn’t find my files. I re upload the files - I cannot select upload zip or upload folder, it says it is not available in my browser (tried with Safari and with Firefox). So I upload files by selecting all files, and the upload progress bar completes but says “the upload failed: 404 / not found”.

Even with the upload failing, now I have the files in my HT folder and the config file entries match my database entries and passwords and so on. However on the link you sent, I cannot find where to input step 4 “update_here”.

Thank you - but on one of the comments on this thread Is there a guide to migrate my website to Infinity Free? - #3 by SPARSHTECHER.EU.ORG - which is where I found the first link that you sent, a moderator recommends not to use WP automatic backups at risk of being suspended.

Anyway, I don’t think I have uninstalled WP on my old host (should I have done that?), I definitely have installed it with Softaculous , what do you recommend that I do now? I still think my problem is that the domain isn’t properly linked with the database, and that in Infinity Free “My Account” page (the one which is split into Cpanel on the left and FTP on the right), the details on the bottom left for My SQL Database do NOT reflect the database name that I created to install my SQL files. And so far I have not been able to edit the file name that shows up there. I have added a screenshot from My Account page, the Database Name has XXX and not what I renamed it to. Clicking on “my SQL database” does not let me edit it.

In other words, I have created a database and uploaded files but this is not reflected in my account.

It seems you have removed the domain from your account and added it again. In doing so, the domain got assigned to a different folder, from htdocs to chiroclinic.es/htdocs. You’ll need to move (or re-upload) your files to the new folder for them to be used on your site.

The file manager doesn’t work well with big archives. Using FileZilla works much more reliably.

I would leave the site on the old host as-is (in case you need a fresh backup), and remove the Softaculous installation. Because you want moving an existing website, you don’t want to install a new website first.

The “Database Name” in the client area is not your actual database name. The actual databases can be found in the control panel.

The reason is that the client area doesn’t know the databases on your account, and because you can have up to 400 databases on a single account, each with their own name.

So the username, password and hostname can all be retrieved from there. The actual database name can be found in the control panel.


Okay, I’ve deleted the folder chiroclinic.es and kept the folder HTdocs which has the amended wp config file. Now when I try to access the website through the browser it gives a 404 not found error.

Yes, of course you get a 404 error, you removed the directory that your domain is linked to.

So please follow my instructions instead:

To be extra clear: that means you need to move the files of the htdocs folder to the chiroclinic.es/htdocs folder.

The current contents of the main htdocs folder is basically irrelevant because there is no domain linked to that folder.


Hi, thanks yes you’re right I didn’t follow your instructions - I’ve done that now and it says again, error establishing database connection.

I checked your wp-config.php and I see the password is not correct. I don’t know where that password is from, but it contains characters that hosting account passwords can’t even have.

The password is something you can copy from the MySQL Details in the client area (all the values are correct, except for the database name because you need to set those up yourself).


Great, thank you for that! I had copied my Infinity Free account password and put it there, now I have changed it to match the MySQL password from the clients area.

When I access my domain now, it sends me to a WP installation. I installed WP and logged in, but when I access my website, none of my pages are there…

That may have been your client area password. Whenever you read “account”, it refers to a hosting account. Your client area profile can also be considered an “account”, but we don’t call it that.

If you got through the WordPress installation wizard, it means you installed a fresh copy of WordPress.

In general, if you’ve moving your website and you see an installation wizard, that means something went wrong.

To fix this, I would suggest to remove the wp-config.php file in your site, take the one from your backup, enter the database credentials and upload that one instead. And also remove, recreate, and reupload your database.

If everything went, you should see your site right away. If you get an installation page, then STOP and check what you’ve done so far. You NEVER want to go through the installation wizard unless you’re setting up a new site.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.