/ Published in: MySQL
URL: http://www.webcheatsheet.com/SQL/mysql_backup_restore.php#restore
Expand |
Embed | Plain Text
/* Back up From the Command Line (using mysqldump) */ mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql] /* Back up your MySQL Database with Compress */ mysqldump -u [uname] -p[pass] [dbname] | gzip -9 > [backupfile.sql.gz] /* Restoring your MySQL Database */ mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql]
Comments
Subscribe to comments
You need to login to post a comment.

Using -p[pass] is a pretty bad idea. This will log the password to .bash_history
instead just use the -p switch and mySQL will prompt you for the password of the user. That way it won't be logged to the bash_history file