Module: MysqlSlaver::MysqlCommand
- Included in:
- DbCopier, MasterChanger, StatusFetcher
- Defined in:
- lib/mysql_slaver/mysql_command.rb
Instance Method Summary collapse
Instance Method Details
#mysql_command(cmd, params) ⇒ Object
14 15 16 17 |
# File 'lib/mysql_slaver/mysql_command.rb', line 14 def mysql_command(cmd, params) creds = mysql_credentials('root', params) %[mysql #{creds} -e "#{cmd}"] end |
#mysql_credentials(user, params) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/mysql_slaver/mysql_command.rb', line 3 def mysql_credentials(user, params) password = params.fetch(:root_password, "") socket_file = params.fetch(:socket_file, nil) rtn = "" rtn << "-S #{socket_file}" if socket_file rtn << " -u #{user}" rtn << " -p #{password}" unless password.to_s == "" rtn end |