summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-08-14 17:12:57 +0000
committerStan Hu <stanhu@gmail.com>2015-08-14 17:12:57 +0000
commit494afae08d457a07c0809bb3fbf954ef9b70b554 (patch)
tree418e552b03120611275507d27594bd32faaf4e41
parent317b7ad3e8e78544996feb4978da17a50f67c176 (diff)
parent7430e7b5fc5d9c24a3d86166153e555e0a3812f1 (diff)
downloadgitlab-ce-494afae08d457a07c0809bb3fbf954ef9b70b554.tar.gz
Merge branch 'mysql_insecure_password_warnings' into 'master'
Workaround the insecure password warnings emitted by MySQL 5.6 When using MySQL 5.6, the following output is emitted every time a backup is created, even with CRON=1. ``` Warning: Using a password on the command line interface can be insecure. ``` This fix works around that by sending the password via the [`MYSQL_PWD`](http://dev.mysql.com/doc/refman/5.6/en/environment-variables.html) environment variable. See merge request !1139
-rw-r--r--lib/backup/database.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/backup/database.rb b/lib/backup/database.rb
index bbb230a10f0..939f28fc1c6 100644
--- a/lib/backup/database.rb
+++ b/lib/backup/database.rb
@@ -18,6 +18,8 @@ module Backup
success = case config["adapter"]
when /^mysql/ then
$progress.print "Dumping MySQL database #{config['database']} ... "
+ # Workaround warnings from MySQL 5.6 about passwords on cmd line
+ ENV['MYSQL_PWD'] = config["password"].to_s if config["password"]
system('mysqldump', *mysql_args, config['database'], out: db_file_name)
when "postgresql" then
$progress.print "Dumping PostgreSQL database #{config['database']} ... "
@@ -43,6 +45,8 @@ module Backup
success = case config["adapter"]
when /^mysql/ then
$progress.print "Restoring MySQL database #{config['database']} ... "
+ # Workaround warnings from MySQL 5.6 about passwords on cmd line
+ ENV['MYSQL_PWD'] = config["password"].to_s if config["password"]
system('mysql', *mysql_args, config['database'], in: db_file_name)
when "postgresql" then
$progress.print "Restoring PostgreSQL database #{config['database']} ... "
@@ -69,8 +73,7 @@ module Backup
'port' => '--port',
'socket' => '--socket',
'username' => '--user',
- 'encoding' => '--default-character-set',
- 'password' => '--password'
+ 'encoding' => '--default-character-set'
}
args.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact
end