exec Rails c
IRB (main):008:0> r = Activerecord::base.connection.execute'Show CREATE Database Ott_remote_cms_production'=#<mysql2::result:0x002b338fe61d68 @query_options ={:as=>:array,: Async=>false,:cast_booleans=> False,: Symbolize_keys=>false,:d ATABASE_TIMEZONE=>:UTC,: Application_timezone=>nil,: Cache_rows=>true ,: connect_flags=>214125,: Cast=>true,:d Efault_file=>nil,:d efault_group=>nil,:adapter=> "Mysql2",: Encoding=> "UTF8",:p ool=>5,:username=> "",:p assword=> ",:host=>" ",:p ort=>3306,:d atabase=>" Cms_production ",:flags=>2}>IRB (main):009:0> R.each {|row|puts row}ott_remote_cms_productioncreate DATABASE ' cms_production '/*!40100 DEFAULT CHARACTER SET UTF8 */=> [["cms_production","CREATE DATABASE ' ott_remote_cms_production '/*!40100 DEFAULT CHARACTER SET UTF8 * /"]]
> r = Activerecord::base.connection.execute'Show Tables'=#<mysql2::result:0x002b338fe01aa8 @query_options ={:as=>:array,: Async=>false,:cast_booleans=> False,: Symbolize_keys=>false,:d ATABASE_TIMEZONE=>:UTC,: Application_timezone=>nil,: Cache_rows=>true ,: connect_flags=>214125,: Cast=>true,:d Efault_file=>nil,:d efault_group=>nil,:adapter=> "Mysql2",: Encoding=> "UTF8",:p ool=>5,:username=> "",:p assword=> ",:host=>" ",:p ort=>3306,:d atabase=>" Cms_production ",:flags=>2}>IRB (main):016:0> R.each {|row|puts row}=[]IRB (main):017:0> r = Activerecord::base.connection.execute'Show variables like "%char%"'; IRB (main): 018:0* R.each {|row|puts Row}character_set_clientutf8character_set_connectionutf8character_set_databaseutf8character_set_ Filesystembinarycharacter_set_resultsutf8character_set_serverutf8character_set_systemutf8character_sets_dir /usr/share/mysql/charsets/=> [["character_set_client","UTF8"], ["character_set_connection","UTF8"], ["Character_set_database","UTF8"], ["Character_set_filesystem","binary"], ["Character_set_results","UTF8"], ["Character_set_server","UTF8"], ["Character_set_system","UTF8"], ["Character_sets_dir","/usr/share/mysql/charsets/"]]
Execute SQL statements from Rails console