between 0 and 1

[MySQL] backup (mysqldump) bash script without password 본문

Software Development Engineering/MySQL

[MySQL] backup (mysqldump) bash script without password

devxpert.yoon 2021. 1. 26. 17:09
728x90
반응형

to backup by using mysqldump without password, 

it needs 2 files.

 

- bash script file (~.sh) and mysql configuration file (w/ any filename and extension)

 

1. create bash script file.

$> vim backup.sh

mysqldump --defaults-extra-file=./.sqlconf databaseName > ./backupdb/"$(date '+%F').sql"

* -p option must be excluded from the command in order to use the password in the config file.

 

 

2. create mysql configuration file for mysqldump

$> vim .sqlconf

[mysqldump]
user=databaseUser
password=databasePassword

 

728x90
반응형