To backup the database
$ mysqldump -u user -p backup.sql
or To backup specific tables from the database
$ mysqldump -u -p [table1 table2 ..] > backup.sql
or To backup set of databases
$ mysqldump -u user -p --databases [database_name database_name ..] >backup.sql
or To backup all databases
$ mysqldump -u user -p --all-databases > backup.sql
or To backup only the structure of the MySQL database, with no data
$ mysqldump -u user -p --no-data --databases [..] > backup.sql
or To zip the MySQL data
$ mysqldump -u user -p --all-databases | gzip > backup.sql.gz
-------------
To restore a database from backup.sql
$ mysql -u user -p < backup.sql
To restore all databases from backup.sql
$ mysql -u user -p < backup.sql
or Restore from a conpressed file
$ gzip | backup.sql.gz > mysql -u user -p
No comments:
Post a Comment