# Database Backup Restore

##### A Simple Database Backup:

You can use mysqldump to create a simple backup of your database using the following syntax.  
Execute the following commands at the terminal to backup the koha database

Command:

```
mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]
```

\[username\] - this is your database username

\[password\] - this is the password for your database  
\[databasename\] - the name of your database  
\[backupfile.sql\] - the file to which the backup should be written.

```
mysqldump –u root -p koha_library> backup_05-10-2016.sql
```

##### A Simple Database Restore:

  
If you have to re-build your database from scratch, you can easily restore the mysqldump file by using the mysql command. This method is usually used to recreate or rebuild the database from scratch.   
Here's how you would restore your backup\_15-10-2016.sql file to the Customers database.   
Execute the following commands at the terminal to restore the koha database

```
mysql –u root -p koha_library< backup_05-10-2016.sql 
```

\#mysql -u \[username\] -p \[password\] \[database\_to\_restore\] &lt; \[backupfile\]  
Or we can use phpmyadmin to do this easily.