BACKUP DATABASE
Mysqldump command examples:To perform the online backup of the database to the file mydb copia_seguridad.sql
mysqldump --opt mydb > backupfile.sql
Another more complex example of mysqldump to backup a database is as follows:
mysqldump --opt -password=mypassword -user=miuser mydatabase > backupfile.sql
In the latter case we are indicating a user name and password to access the database on which the backup is being done: mydatabase. SQL statements to rebuild that database file will be flushed archivo.sql.
RESTORE DATABASE
If we want to retrieve information from a file to restore a backup of the database will do with the mysql command. We will use a syntax like:mysql mydb
This example is based restore mydb data stored in the backup file archivo.sql.
Another example of more complex command to restore a database is as follows:
mysql -password=mypassword -user=miuser mydb < backupfile.sql
Hope help!
No comments:
Post a Comment