In this case, we’re telling mysqldump to put our backup here in the file named /path/to/save/backup_file.sql. Whoa! Our whole database backup was printed to the screen!īy using the > operator, we can tell mysqldump where to put our backup, so we can download and use it. This is what is printed to the screen after running the command without output redirection: - MySQL dump 10.13 Distrib 5.5.40, for debian-linux-gnu (x86_64) To understand output redirection better, let’s see what would happen if we didn’t add the > to the end of our command. The > after my_db_name is called an “output redirection symbol”, which is just a fancy way of telling mysqldump to send the backup data to a specific file. We’re showing you this use of the -p flag just for completeness, so you know how each of these bits and bobs works. Note that it’s possible to enter the password directly on the command line like so: mysqldump -u my_db_user -pmy_db_password my_db_name > /path/to/save/backup_file.sqlīeware: Entering the password this way is considered bad security practice because it makes the password visible to programs that don’t need to know about it. The -p flag tells mysqldump that my_db_user has a password, and we’re going to provide that password. For our purposes, we just need to make sure that my_db_user is allowed to read the database we’re trying to back up. The -u flag tells mysqldump to use my_db_user to back up our database. Flags give the command-line utility (in this case, mysqldump) answers it needs to run correctly. If you’re not familiar with command line lingo, the “dash-followed-by-letters” are called “flags”. With our database info in hand we can run the mysqldump command, which looks like this: mysqldump -u my_db_user -p my_db_name > /path/to/save/backup_file.sql The configuration values will look something like this: /** The name of the database for WordPress */ If you don’t know these by heart, you can reference the wp-config.php file for your WordPress site.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |