我按照here安装了运行 mongify 所需的所有工具,但我仍然收到此错误 -
/home//.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem mongify (>= 0.a) (Gem::GemNotFoundException)
from /home//.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path'
from /home//.rvm/gems/ruby-2.3.0/bin/mongify:22:in `<main>'
from /home//.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /home//.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
这是我的宝石清单:
*** LOCAL GEMS ***
activemodel (4.2.7.1)
activerecord (4.2.7.1)
activesupport (4.2.7.1)
arel (6.0.4)
bigdecimal (default: 1.2.8)
bson (1.12.5)
bson_ext (1.12.5)
builder (3.2.3)
bundler (1.14.2)
bundler-unload (1.0.2)
did_you_mean (1.0.0)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
highline (1.7.8)
i18n (0.7.0)
io-console (default: 0.4.5)
json (default: 1.8.3)
json_pure (2.0.3)
minitest (5.8.3)
mongify (1.3.1)
mongo (1.12.5)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (default: 2.0.17)
rake (10.4.2)
rdoc (5.0.0, default: 4.2.1)
rubygems-bundler (1.4.4)
rubygems-update (2.6.10)
rvm (1.11.3.9)
test-unit (3.1.5)
thread_safe (0.3.5)
tzinfo (1.2.2)
答案 0 :(得分:0)
你是如何安装宝石<?php
$var1 = $_POST['var1'];
$var2 = $_POST['var2'];
$getvalue="SELECT id,name from table1 WHERE column1='$var1' and column2='$var2'";
$result=mysql_query($getvalue) or die(mysql_error());
while($row=mysql_fetch_array($result)){
extract($row);
echo $name;
}
?>
的?如果您使用mongify
,它将帮助您修复所有依赖项,例如
bundler
或者,您确定在安装该宝石时出错了吗?检查了您的错误消息,看起来您执行了宝石cli
» gem install mongify
?
请粘贴完整的错误消息。我会更新我的答案。
Fetching: activemodel-4.2.7.1.gem (100%)
Successfully installed activemodel-4.2.7.1
Fetching: arel-6.0.4.gem (100%)
Successfully installed arel-6.0.4
Fetching: activerecord-4.2.7.1.gem (100%)
Successfully installed activerecord-4.2.7.1
Fetching: bson-1.12.5.gem (100%)
Successfully installed bson-1.12.5
Fetching: mongo-1.12.5.gem (100%)
Successfully installed mongo-1.12.5
Fetching: bson_ext-1.12.5.gem (100%)
Building native extensions. This could take a while...
Successfully installed bson_ext-1.12.5
Fetching: highline-1.7.8.gem (100%)
Successfully installed highline-1.7.8
Fetching: mongify-1.3.1.gem (100%)
Successfully installed mongify-1.3.1
8 gems installed
答案 1 :(得分:0)
这是一个宝石错误。
首先,您需要找到“ Gemfile ”
然后运行 - cd /.gemspecs/did_you_mean-1.0.0
然后运行 - 捆绑安装 - 生产
然后如果没有安装run- gem install mysql2
现在安装了所有必需的宝石。
现在运行 - mongify
现在如果mongify工作,你需要检查SQL和NoSQL的连接
所以运行 - mongify check database.config
在database.config文件中,你需要这个 -
sql_connection do
adapter "mysql2"
host "127.0.0.1"
username "root"
password "root"
database "database_name"
end
mongodb_connection do
host "127.0.0.1"
database "database_name"
end
现在你会看到 -
SQL连接正常工作
NoSQL连接正常工作
然后运行 - mongify translation database.config&gt; translation.rb 强>
和 - mongify process database.config translation.rb
现在数据将从MySQL DB迁移到MongoDB。
要了解更多有关 mongify 的详细信息,请阅读此link
答案 2 :(得分:0)
For Mac:
1. Download and install the mysql installer. (https://dev.mysql.com/downloads/mysql/)
Open Terminal
2. sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config