The following commands work for me in MariaDB.
This one backs up the database called databaseName:
$ mysqldump -u root -p \
--set-charset \
--default-character-set=utf8 \
--databases databaseName \
--result-file=databaseName.sql
These ones restore the database for me by using the SQL file:
$ mysql -u root -p
$ create database databaseName default character set utf8;
$ use databaseName;
$ source /path/to/sql/file/databaseName.sql;
The SQL file can be very big.
To reduce its size, do:
$ gzip -c databaseName.sql > databaseName_2013_08_12_09_30.sql.gz
Add the date and time for future reference.
To get back the SQL file, do:
$ zcat databaseName_2013_08_12_09_30.sql.gz > whateverName.sql
References:
http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
http://forums.mysql.com/read.php?104,145923,148081
http://linux.about.com/od/commands/a/Example-Uses-Of-The-Command-Gzip.htm
http://pic.dhe.ibm.com/infocenter/aix/v7r1/index.jsp?topic=%2Fcom.ibm.aix.cmds%2Fdoc%2Faixcmds6%2Fzcat.htm
No comments:
Post a Comment