backup of mysql database
-
hi all,
it says to run this command to backup the fog database
mysqldump --allow-keywords -x -v fog > fogbackup.sql
but looking elsewhere it says the way you backup databases is like so
mysqldump -u [username] -p[password] [database_name] > [backup_file_name].sql
so what do the options mean ie allow keywords and x and v
thanks,
rob -
@robertkwild https://linux.die.net/man/1/mysqldump
--allow-keywords
- Permit creation of column names that are keywords. This works by prefixing each column name with the table name. (So group/groups is a column name that is also known as a keyword)-x
- Lock all tables across all databases. This is achieved by acquiring a global read lock for the duration of the whole dump. This option automatically turns off --single-transaction and --lock-tables. (So when you’re backing up the database data can’t accidentally be injected.-v
- Verbose mode. Print more information about what the program does. (So when you’re runnning the backup you can see what’s going on.)The information that tells you this is just assuming basic information. If you need to enter username/password you can do:
mysqldump -u[username] -p --allow-keywords -x -v fog > fogbackup.sql
if you so choose.By not introducing the password it will prompt you for it rather than you putting it in while you run the command. (Keeping the password hidden from history commands)
-
@tom-elliott thank you
so really, i should run the command shown in the fog backup as its a better way
-
@robertkwild “better” is a relative term. I suggest following the command because we know it will do what it needs to do properly.