0

Some background:

My website with blog had been moved to a new hosting company. Everything worked great. I periodically logged into the blog to update wordpress whenever prompted and all was well.

Months passed, I hadn't connected to the blog (I suck as a blogger, but what I have up I want to remain available), and I got "error connecting to database."

I found the hostname for the blog's database on the web site for the hosting company, so added that to the wp-config.php file (instead of 'localhost'). I had also used their file manager to move the directory holding the blog from the old locatoin to a new then updated w-config.php Now if I try to go to the blog it is prompting me to install wordpress.

Questions:

Are there . files that I can't see in the host's file manager that need to be moved over? If so, I'll have to figure out command line access.

Are there files that should NOT be there that make it look like it's being installed?

Any ideas/questions?

Thanks much in advance!

  • There is usually a .htaccess file with WordPress, but it will automatically regenerate a new one if it is missing. It sounds like you may have copied all your files over but never copied over the database - if you only pointed wp-config to a new database and did not actually export the database from the old host and import it into the new host, then all of your content is missing. You may need to contact the old host to see if anything is retrievable, do a site: search on Google to see if it has anything cached that you can recover, or check Wayback Machine to see if they have copies. – WebElaine Jan 31 at 22:20
  • Wordpress WAS working on this host, the last time I logged into the blog I was upgrading wordpress. The only change is the location of the wordpress files. I had to move everything from a subdirectory up to the main/root directory for my domain. I THOUGHT I captured everything from the wordpress directory. What I did was change the line in the wp-config to give the name of the host: /** MySQL hostname / /* define('DB_HOST', 'mysqlcluster24'); */ define('DB_HOST', 'localhost'); "localhost" - error connecting to database "mysqlcluster24" - install wordpress – mrsspooky Feb 1 at 2:05
0

If you moved the folder of the root of the site, so that the URL is https://www.example.com instead of https://www.example.com/blog , then you need to tell the database that's where the site lives.

This is done by modifying two entries in the wp-options table to change the URL. You will also need to change the URLs that are stored in the database for media files - each media file has it's full URL as part of the database.

To do that, you can use a "search and replace" plugin (I like "Better Search and Replace", but there are others) to search for the old URL (https://www.example.com/blog ) and replace it with the new URL (https://www.example.com ). But that should be done after you can get to the site and the site's admin area.

You may also need to change your htaccess file, since you moved the site's URL out of a folder to the root of your domain.

There are several help files you might find useful:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.