0

我电脑的主硬盘驱动器昨天坏了,我得到了一个新的并恢复了它,但是当我去恢复我的 mysql 数据库时,我意识到我有一段时间没有做适当的备份了。尽管如此,我确实有我之前安装的原始数据库文件,因为数据文件位于第二个 HDD 中。

我的问题是,我可以仅使用以前安装中的文件在新机器中恢复/创建新数据库吗?

谢谢,伊格纳西奥

4

1 回答 1

0

Yes, you should be able to do this.

I'm a bit unclear: when you say, "I do have the original database files" do you mean as a database? If so, go to phpMySql for the surviving database and choose Export. Export the database as a text file. Open the file with your favorite text editor and change the name of the database to match the name you are importing into.

Create the empty database where you want the new one to be, if it doesn't already exist. Now go to phpMySql for that database and import your text file. This should recreate all the tables and their data in the new location.

If instead, you only have the files that were the source of the data, then you need to use whatever tool was used to create the database in the first place. For example, if the data is in the form on an Excel spreadsheet, you would use MySql for Excel.

Hope this helps!

(after your comment that you have file backups of WordPress site)

In that case, you may not be so lucky. If you used a tool to do your backup, it may have backed up the database, but in general, the database is stored separately from your file system. So if you just copied the files yourself, you won't have the database. But do look for any file with a suffix of .SQL, which would be a database backup.

Next, contact your Internet Service Provider and see if they do periodic database backups. If so, you can recover from them.

For the future, see if your ISP provides automated backups (including database). And read https://codex.wordpress.org/WordPress_Backups.

于 2015-08-14T22:43:34.150 回答