Support » Installing WordPress » Error establishing a database connection

  • venomshot629


    I recently switched hosts from Topcities/Serverpro to HostGator.

    Before I switched, I backed up all of my files from the root of my website hosted by Topcities at, onto my computer.

    I am now with HostGator and went to copy and paste all of my files within the public_html folder (including my wordpress folder/files), and my site is not working, and I am not able to log in.

    I did go into my wp-config file, and even quick-installed a copy of wordpress and copied the database info from that wp-config file, however I did not see any of my posts/pages from when my website was hosted at topcities. I am now getting the “Error establishing a database connection” message.

    My wordpress installation is located within … Do I need to delete all of the files in the root of my HostGator, and copy over all of my backed up folders from the root of my Topcities backup (.cpaddons, .cpanel, .htpasswords, access-logs, etc, mail, public_ftp, public_html, tmp, www) for my files to show up and to be able to login correctly?


Viewing 5 replies - 1 through 5 (of 5 total)
  • techbrij


    No, you need not to copy all folders, As you have done is correct(only public_html). See step by step guide to fix Error establishing a database connection . It might help you.

    Samuel B


    did you export the database from the old site?



    All you need is your public_html folder the others are created by hostgator so do not change any of them as they are your setting for account.

    You will need backup of your database that you import in hostgator.



    Thanks for the responses.

    I did not export the database at the time of the first post I made here, but now I did. I imported it on the new system and created a new database, changed my wpconfig file to match it, and now the site works and let me login, but…

    Now none of my pages are working. I see all of my pages and posts in the WP Admin section, and all of the content and plugins are there, none of my links are working on my site when I click them from the initial page at



    Nevermind, HostGator fixed it, they said they had to reset my .htaccess file back to default, and all pages showed up immediately.

    Thanks again everyone.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Error establishing a database connection’ is closed to new replies.