backup_mysql_database_from_the_command_line
Differences
This shows you the differences between two versions of the page.
| backup_mysql_database_from_the_command_line [2016/07/24 15:55] โ created walkeradmin | backup_mysql_database_from_the_command_line [2016/07/24 16:03] (current) โ walkeradmin | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| \\ | \\ | ||
| \\ | \\ | ||
| - | From the command line: | + | From the command line:\\ |
| \\ | \\ | ||
| First you must login to MySQL | First you must login to MySQL | ||
| \\ | \\ | ||
| + | mysql -u root -p โ (the root part assumes root is your mysql username) | ||
| \\ | \\ | ||
| + | A database backup is essentially a file that contains all the tables, fields and data from your database, stored in a text file. | ||
| \\ | \\ | ||
| + | To perform a backup, use the following command line: | ||
| + | \\ | ||
| + | mysqldump database_name > database_name.sql | ||
| + | database name is the SQL database name (the output can be different) | ||
| + | | ||
| + | e.g. mysqldump gallery > gallery.sql | ||
| + | \\ | ||
| + | This command only backs up a single database, if you wish to do multiple databases then use: | ||
| + | \\ | ||
| + | mysqldump --databases database_one database_two > two_databases.sql | ||
| + | \\ | ||
| + | This allows the backup of many databases, in to one backup file. | ||
| + | \\ | ||
| + | \\ | ||
| + | You can backup all databases with this command: | ||
| + | \\ | ||
| + | mysqldump --all-databases > all_databases.sql | ||
| + | \\ | ||
| + | |||
| + | |||
backup_mysql_database_from_the_command_line.1469375759.txt.gz ยท Last modified: (external edit)
