Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Recovering mysql from backups

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 177
    Comment on it

    Here we will learn how to restore the database from a backup using mysql commands we need to follow the following steps for the process

    1. We must have a database dump that we want to restore on the machine with the correct database name for which we are doing the restore process.
    2. Now we will load the backup file using the mysql command.

    Lets say we have a dump for a database name test.sql

    and we have a database test in the MYSQL Workbench or SQLyog.

    Now we will use the following mysql command to restore our test.sql file to the test database.

    $ mysql -u root -p test <test.sql
    

    or

    $ mysql -u root -p test < /var/www/html/myfolder/test.sql 
    

    Restoring the database from a compressed dump file we use the following command and we must have a database in the targeted machine for which we are restoring:

    gunzip < [test.sql.gz] | mysql -u [uname] -p[pass] [dbname]
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: