MySQL Quick reference

To save the mysql username & password you use via command line, use the following;

Add ~/.my.cnf file with the following content

[Client]
user=myusernamehere
password=mypasswordhere
host=localhost
database=mydbnamehere

For DB Dumps via command line (in *nix);

Compressing;
mysqldump dbname | gzip -c > myfilename.sql.gz

Resoring DB;
gunzip -c myfilename.sql.gz | mysql dbname

Leave a Reply