Saturday, July 07, 2007

Backups

This is great for backups. I found this while reading the man file for mysqldump
that should really help


shell> mysqldump [options] db_name [tables]
shell> mysqldump [options] --databases db_name1 [db_name2 db_name3...]
shell> mysqldump [options] --all-databases

the -u and -p commands : user and password remain the same throughout almost all mysql operations.
So
mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]

as for the restore

mysql -u [username] -p [password] [database_to_restore] < [backupfile]



Tar's Hidden Power

just as tar -xzvf file.tar.gz extracts all files to current direcotry
tar -xzvf file.tar.gz readme.txt will extract just the readme.

as well
tar -czf file.tar.gz directory/ will create a file from the directory. Not sure but perhaps using * or just typing in the files you want one by one might work fine too. Worth a shot.


Well I've learned alot more tonight... Just a few more tricks that I hope stay around.

No comments: