简体   繁体   English

如何从备份还原MySQL数据库

[英]How do I restore MySQL DB from backup

My server recently crashed and I have backed the Mysql files using raid. 我的服务器最近崩溃了,我已经使用raid备份了Mysql文件。

BACKED UP DIRECTORY 备份目录

/backup/var/lib/mysql

I installed new OS(RHEL5.3) to my server and I want to restore my DB to MySQL 我在服务器上安装了新OS(RHEL5.3) ,我想将数据库恢复到MySQL

How do I do this? 我该怎么做呢?
I know you can ssh mysql > the dump files 我知道你可以ssh mysql > the dump files
but, these backed up files are not in DUMP. 但是,这些备份文件不在DUMP中。
They are separated as .MYD .MYI .frm etc.. 它们被分隔为.MYD .MYI .frm等。

I guess your backup file is not in the same server as your database. 我猜您的备份文件与数据库不在同一服务器上。

Try: 尝试:

scp -r /backup/var/lib/mysql/* DB_SERVER:YOUR_NEW_DATABASE_DIRECTORY

Then 然后

ssh DB_SERVER
.. restart your mysql daemon (easier)
.. or flush privileges, flush tables ...

Copy these files directly to your mysql data directory, and you will be able to access them in MySQL. 将这些文件直接复制到您的mysql数据目录中,您将可以在MySQL中访问它们。 That should help you! 那应该对你有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM