如何从备份文件恢复Mysql数据库

问题描述:

我使用的VPS必须重新成像。我的DB是它的一部分,它正在备份,因为应用程序还没有在生产中。但是,有一些数据,我希望恢复它。 VPS提供商给我一个备份的图像(Ubunto Linux),它有所有的文件。

I have using VPS that had to be re-imaged. my DB was part of it and it was being backup up as the app wasn't in production yet. However, there is some data that I wish to recover on it. the VPS provider is giving me a backup of the image (Ubunto Linux) that has all the files.

有没有方法可以恢复我的数据?

Is there a way I can recover my data?

Ubuntu中的mysql数据文件位于 / var / lib / mysql

The mysql data files in Ubuntu are located at /var/lib/mysql

要恢复数据库,您需要:

To restore your database you need:

1)创建名为旧的新数据库

2)停止mysql服务器

3)复制旧的数据库文件 / var / lib / mysql / your_database_name / 新系统

4)启动mysql服务器

1) create new database named as old one
2) stop mysql server
3) copy old database files from /var/lib/mysql/your_database_name/ to new system
4) start mysql server

您的数据库将还原。