Backup and Restore the mysql database in Linux cli mode
1. 'mysqldump' command is used to backup the database in linux.
Backup Syntax :-
#mysqldump -udatabase -p databasename > databasename.sql
Once database backup completed from source side copy the .sql file to Destination Server and restore the backup file.
Before restore create the database and user if not exists.
>create database databasename;
>create user 'database'@'localhost';
>grant all privileges on databasename.* to 'database'@'localhost';
>flush privileges;
Now restore the database
#mysql -udatabase -p databasename < databasename.sql
No comments:
Post a Comment