Creating database backup:
Change directory to a backup directory you want.
1. mysqldump -u root testdb > testdb_bckup.sql
1. mysqldump -u root testdb > testdb_bckup.sql
Note – testdb is database name which back up has to be taken. testdb_bckup is saved database name. root is user having privilege to take back up.
Restoring Database:
1. Move the sql file to the server into a specific directory. Say /usr/src/local
2. Change directory to the one created in step 1 (/usr/src/local) using cd command.
3. Go to mysql prompt using “mysql” command.
4. drop existing database using “drop database test;”
5. Create new database using “create database test;”
6. Restore db using “source sql_file_name.sql;” command.
2. Change directory to the one created in step 1 (/usr/src/local) using cd command.
3. Go to mysql prompt using “mysql” command.
4. drop existing database using “drop database test;”
5. Create new database using “create database test;”
6. Restore db using “source sql_file_name.sql;” command.
No comments:
Post a Comment