Quick command line MYSQL backup or copy your mysql database
Just a quick note on how to backup or copy your database through the command line.
First thing you need is a sql dump of your database :-
Show Plain TextText code
- mysqldump --add-drop-table -h <hostname -u <user_name> -p <database_name> > database_name.sql
Now login to your mysql :-
Show Plain TextText code
- mysql -h <hostname> -u <user_name> -p
Now create your new database :-
Show Plain TextText code
- create new_database;
Now copy your data to the new database :-
Show Plain TextText code
- use new_database;
- source database_name.sql;
Job done