Search code examples
mysqlsshmysql-backup

How do I restore MySQL DB from backup


My server recently crashed and I have backed the Mysql files using raid.

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

How do I do this?
I know you can ssh mysql > the dump files
but, these backed up files are not in DUMP.
They are separated as .MYD .MYI .frm etc..


Solution

  • 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 ...