Restore MySQL database from sql dump backup file

Question:  How to restore the MySQL database from sql dump file ?

Mysql in linux

Answer: It is simple to restore the MySQL database from sql dump file .in command line .

Syntax:

# mysql -u [DB_user] -p  [DB_name] <  dumpfile.sql

Note: Make sure the restoring database is already created in your MySQL database server .

Example:

# mysql -u sekar -p my_db <  my_db.sql
Enter password: < Enter your mysql password here  >

To restore the sql dump backup file  from remote system .

# mysql -u sekar  -h [remote_DB_IP] -p my_db < my_db.sql
Enter password: < Enter your mysql password here  >

For remote mysql database restore  using  sql dump file, make sure the user is granted permission to that database server from remote system..




Leave a Reply

Your email address will not be published. Required fields are marked *