Commit 7430e7b5 authored by Ted Strzalkowski's avatar Ted Strzalkowski

Workaround the warnings emitted by MySQL 5.6 regarding password on the

command line.
parent fed202f6
...@@ -18,6 +18,8 @@ module Backup ...@@ -18,6 +18,8 @@ module Backup
success = case config["adapter"] success = case config["adapter"]
when /^mysql/ then when /^mysql/ then
$progress.print "Dumping MySQL database #{config['database']} ... " $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) system('mysqldump', *mysql_args, config['database'], out: db_file_name)
when "postgresql" then when "postgresql" then
$progress.print "Dumping PostgreSQL database #{config['database']} ... " $progress.print "Dumping PostgreSQL database #{config['database']} ... "
...@@ -43,6 +45,8 @@ module Backup ...@@ -43,6 +45,8 @@ module Backup
success = case config["adapter"] success = case config["adapter"]
when /^mysql/ then when /^mysql/ then
$progress.print "Restoring MySQL database #{config['database']} ... " $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) system('mysql', *mysql_args, config['database'], in: db_file_name)
when "postgresql" then when "postgresql" then
$progress.print "Restoring PostgreSQL database #{config['database']} ... " $progress.print "Restoring PostgreSQL database #{config['database']} ... "
...@@ -69,8 +73,7 @@ module Backup ...@@ -69,8 +73,7 @@ module Backup
'port' => '--port', 'port' => '--port',
'socket' => '--socket', 'socket' => '--socket',
'username' => '--user', 'username' => '--user',
'encoding' => '--default-character-set', 'encoding' => '--default-character-set'
'password' => '--password'
} }
args.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact args.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment