Last active
December 21, 2015 16:36
-
-
Save lavoiesl/2626426 to your computer and use it in GitHub Desktop.
Use credentials in /etc/mysql/debian.cnf to export MySQL database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Use credentials in /etc/mysql/debian.cnf to export MySQL database | |
database="$1" | |
shift | |
options="$@" | |
if [[ -z "$database" ]]; then | |
echo "Usage: $0 database [options]" >&2 | |
exit 2 | |
fi | |
sudo mysqldump \ | |
--defaults-file=/etc/mysql/debian.cnf \ | |
--add-drop-table \ | |
--add-locks \ | |
--comments \ | |
--create-options \ | |
--disable-keys \ | |
--dump-date \ | |
--extended-insert \ | |
--no-create-db \ | |
--lock-tables \ | |
--set-charset \ | |
--quick \ | |
--routines \ | |
--events \ | |
--triggers \ | |
$options \ | |
$database |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment