lib/isolated_server/mysql.rb in isolated_server-0.4.7 vs lib/isolated_server/mysql.rb in isolated_server-0.4.8
- old
+ new
@@ -108,11 +108,11 @@
MASTER_USER='root', MASTER_PASSWORD='',
MASTER_LOG_FILE='#{binlog_file}',
MASTER_LOG_POS=#{binlog_pos}
EOL
)
- connection.query("START SLAVE")
+ connection.query("SLAVE START")
connection.query("SET GLOBAL READ_ONLY=1")
end
def set_rw(rw)
ro = rw ? 0 : 1
@@ -126,14 +126,18 @@
system("mkdir #{@mysql_data_dir.shellescape}")
if @load_data_path
system("cp -a #{@load_data_path.shellescape}/* #{@mysql_data_dir.shellescape}")
system("rm -f #{@mysql_data_dir.shellescape}/relay-log.info")
else
+ mysqld = locate_executable("mysqld")
+ `#{mysqld} --version` =~ /^mysqld\s+Ver (5\.\d)\.\d+/
+ major_version = $1
+
mysql_install_db = locate_executable("mysql_install_db")
idb_path = File.dirname(mysql_install_db)
system("(cd #{idb_path.shellescape}/..; mysql_install_db --datadir=#{@mysql_data_dir.shellescape} --user=`whoami`) >/dev/null 2>&1")
- system("cp #{File.expand_path(File.dirname(__FILE__)).shellescape}/mysql/tables/user.* #{@mysql_data_dir.shellescape}/mysql")
+ system("cp #{File.expand_path(File.dirname(__FILE__)).shellescape}/mysql/tables/#{major_version}/user.* #{@mysql_data_dir.shellescape}/mysql")
end
end
def setup_binlog
if !@log_bin