Вопрос

So my web hosting company has restored my hosting files (they were deleted due to a complication), but out of my 4 Wordpress installations 2 of them could not be restored.

I have googled how to restore the database but I only come across people who are restoring from a backup, but I have no backup to restore from; I only have the wordpress files.

What steps must I take to get the sites back online? Ie I guess rebuild the database from scratch but I already have the files (hope that makes sense).

Это было полезно?

Решение

I'm not a programmer or a sql expert, but do have a lot of hosting experience and I can tell you this for sure - if all you have are the Wordpress files (the files in your hosting account) but you don't have a copy of the actual database (usually a .sql file or gzip of it) then you cannot simply restore your Wordpress site content.

The files in your hosting account - the Wordpress files such as index.php and so forth - are not where your posts and page content are stored. They are just files that tell Wordpress how to function. All of your references to the actual content of your posts and pages are stored in the database of your Wordpress.

So, you need the database backup in order to restore your Wordpress to what it was before your mishap.

If you're on typical shared hosting (such as a cPanel host) then you can should be able to access your database through your hosting control panel. Most modern hosts provide you with a hosting control panel that includes direct access to your databases - either through a mySQL tool or phpMyAdmin tool within your hosting control panel.

So for example - if you're on a cPanel host you can log into your cPanel and then click the phpMyAdmin icon to discover the databases you have stored there, and from there you can obtain a copy (export) of your database.

If for some reason you don't have access to a hosting control panel with a tool for accessing your databases, then the next thing would be to get the database through shell (ssh) access, which in a lot of cases is not granted to shared hosting customers.

Ultimately if you have a Wordpress database on the server through your hosting account, your web host can give you a copy of your WP database(s) because they're stored on the web server (either locally on the same server as your web site, or on a mass database server where the host keeps them).

At that point you should submit a request to your host asking for copies / dumps / exports of all your databases, and when they provide you with the database files you could import them back into the corresponding database names via a tool within your hosting control panel (such as phpMyAdmin or mySQL section of your hosting control panel).

Bottom line - you can't restore your Wordpress pages and posts back to what they were without a copy of the database for each Wordpress site you run. Your host has those databases on their server still, unless you accidentally deleted them through one of the tools I've mentioned. If your host tells you that they cannot help you obtain a copy of your database files, then you have a real problem if you don't have your own backup. Database files are not something that you simply upload/download via FTP like your standard html / php files. Database files are stored on the web server of your host and in most cases your host can simply provide you with a dump / export / copy of your databases if you request them. If for some reason you don't have access to a hosting control panel toll where your databases are stored, then request them from your host. If they cannot provide the database file to you and you don't have a backup, then you may be looking at starting from scratch.

As a hosting support tech myself, I can tell you that any good host can easily dump a copy of each of your databases into a folder in your account so that you can import them back using a tool like phpMyAdmin within your hosting account. If they tell you they don't have copies of your databases then you either deleted them (not likely, unless you logged into your control panel and did so unwittingly) or you're with a bad service. (Not jumping to conclusions there, just pointing out the fact that if you didn't remove your databases then they're on the server and any good server admin can give you a copy to restore, along with the instructions.)

It doesn't matter that you have all of the regular files (such as the .php files and .jpg file etc...) on the server if you don't have the database in place that they were connected to, because the database is where much of the content paths and specifics are stored and organized. This characteristic is not exclusive to Wordpress - almost every PHP script is database driven relies on a database for serving the content.

Другие советы

NightOwl's answer is excellent; I would like to add just this. You might have automatic databases backup set up for your account and you don't know it. So I suggest you have a look at your control panel to see whether this is true.

Otherwise, ask again your provider for a more complete restore.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top