Being strict, msqldump is not a "backup utility", it creates a script with "CREATE TABLE" and "INSERT INTO" commands that you can run in your server to re-create your database. mysqldump is shipped with MYSQL so everybody should have it installed.
Using mysqldump command line is very straightforward, just type this in your command line or terminal (using your username and password):
mysqldump -u USERNAME -pPASSWORD OUR_DATABASE > filename.sqlThis will give us a file (filename.sql) containing "CREATE TABLE" and "INSERT INTO" commands for OUR_DATABASE.
Some times you need to dump ALL your databases (you are moving you dev machine) in your MYSQL server:
mysqldump -u USERNAME -pPASSWORD --all-databases > filename.sqlIf you are using MAMP (in macOS), your mysqldump binary is located in /Applications/MAMP/Library/bin/mysqldump.
There is a lot more options here in the official MYSQL documentation: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
To restore our database, we have to we have to run this script in our MYSQL server. You can do it using any utility (phpmyadmin for instance) or jus (again) the command line:
mysql -u USERNAME -pPASSWORD DATABASE_NAME < filename.sqlSo, good backup!! ;-)
No hay comentarios.:
Publicar un comentario