1
我想通過mysqldump命令在rails中轉儲一些mysql表,但是不起作用。mysqldump在rails中的選定表
client = Mysql2::Client.new(:host => "localhost", :username => "root", :database => 'sparta_development')
sql = "mysqldump -u root -p sparta_development config_products > config_products.sql;"
client.query(sql)
錯誤消息:
in `query': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqldump -u root -p sparta_development config_products > config_products.sql' at line 1 (Mysql2::Error)
#mysql --version
mysql Ver 14.14 Distrib 5.5.25a, for osx10.6 (i386) using readline 5.1
#gem list |grep my
mysql2 (0.3.14)
希望有人能幫助我,在此先感謝!