From 274e966a6a5db0daf43928041120b29e66eb2c56 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Sun, 17 Mar 2013 16:27:04 +0100 Subject: `rake db:create` does not change permissions of root user. Closes #8079. I had to rework some of the tests because the mock allowed any arguments for `connection.exeucte`. I think this is very dangerous as there could anything be executed without the tests noticing it. --- activerecord/lib/active_record/tasks/mysql_database_tasks.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb index 10696258c9..50569d2462 100644 --- a/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/mysql_database_tasks.rb @@ -26,7 +26,9 @@ module ActiveRecord $stdout.print error.error establish_connection root_configuration_without_database connection.create_database configuration['database'], creation_options - connection.execute grant_statement.gsub(/\s+/, ' ').strip + if configuration['username'] != 'root' + connection.execute grant_statement.gsub(/\s+/, ' ').strip + end establish_connection configuration else $stderr.puts "Couldn't create database for #{configuration.inspect}, #{creation_options.inspect}" -- cgit v1.2.3