User Tools

Site Tools


backups:backup_and_restore_mysql_databases

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
backups:backup_and_restore_mysql_databases [2017/04/03 14:57] peterbackups:backup_and_restore_mysql_databases [2019/11/26 20:27] (current) – removed peter
Line 1: Line 1:
-====== Backups - Backup and restore mysql databases ====== 
- 
-To backup (dump) a single mysql database to a file: 
- 
-<code bash> 
-mysqldump -u foo -p foodb > foodb.sql 
-</code> 
- 
-where: 
- 
-  * **-u** is for username. 
-  * **-p** is for mysqldump to ask for password. 
-  * **foodb** is the name of the database. 
-  * **foodb.sql** is the file to dump the database. 
- 
- 
-To backup(dump) all databases to a file: 
- 
-<code bash> 
-mysqldump -u foo -p --all-databases > alldb.sql 
-</code> 
- 
-where: 
- 
-  * **-u** is for username. 
-  * **-p** is for mysqldump to ask for password. 
-  * **<nowiki>--all-databases</nowiki>** is to tell mysqldump to dump all databases available. 
-  * **alldb.sql** is the dumpfile name. 
- 
- 
-To restore back mysql database from dumpfile: 
- 
- 
-1. From terminal 
- 
-<code bash> 
-mysql -u foo -p foodb < foodb.sql 
-</code> 
- 
-where: 
- 
-  * **-u** is for username. 
-  * **-p** is for mysqldump to ask for password. 
-  * **foodb** is the name of the database. 
-  * **foodb.sql** is the file to dump the database. 
- 
- 
-2. From inside mysql console where you have to access mysql console first: 
- 
-<code mysql> 
-mysql> source foodb.sql  
- 
-or  
- 
-mysql> \. foodb.sql 
-</code> 
- 
-where foodb.sql is the dumpfile. 
  
backups/backup_and_restore_mysql_databases.1491231433.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki