如何在新机器上为旧应用程序安装mysql?

如何在新机器上为旧应用程序安装mysql?,mysql,ruby-on-rails,rubygems,rake,geocode,Mysql,Ruby On Rails,Rubygems,Rake,Geocode,我不知道该怎么做 我的应用程序的数据库.yml development: adapter: mysql encoding: utf8 reconnect: false database: application-dev pool: 5 username: root password: angles123 socket: /tmp/mysql.sock 我在想,明智的做法是继续使用mysqladmin-u root--password=angles123,然后进入

我不知道该怎么做

我的应用程序的
数据库.yml

development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: application-dev
  pool: 5
  username: root
  password: angles123
  socket: /tmp/mysql.sock
我在想,明智的做法是继续使用
mysqladmin-u root--password=angles123
,然后进入
创建数据库应用程序dev
,但是
-dev
部分,mysql并不满意。但是我可以创建一个简单的数据库,上面写着
应用程序

我可能还错过了什么吗

我之所以提出这个问题,是因为每当我尝试rake db:migrate或script/server时都会出现这个错误

rake db:test:prepare
(in /Users/macuser/Sites/hq_channel)
rake aborted!
uninitialized constant Geocode
所以我假设我设置了错误的数据库,因为我显然安装了gem

以下是完整的堆栈跟踪:

rake aborted!
uninitialized constant Geocode
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in `load_missing_constant'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing_not_from_s3_library'
/Users/macuser/Sites/hq_channel/vendor/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in `const_missing'
/Users/macuser/Sites/hq_channel/config/initializers/geocode.rb:1
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:145:in `load'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:622:in `load_application_initializers'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:621:in `each'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:621:in `load_application_initializers'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:176:in `process'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
/Users/macuser/Sites/hq_channel/config/environment.rb:21
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
/Users/macuser/Sites/hq_channel/vendor/rails/railties/lib/tasks/misc.rake:4
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

我安装的mysql不允许在数据库名称中使用下划线或破折号

您可以尝试将数据库名称更改为
application
,然后运行
rake db:create
,查看它是否创建了您的数据库


此外,您可以尝试使用
--trace
运行rake,以更好地了解导致该错误的地方包含了哪些内容。

我打赌geocode缺少一个library@sam,我尝试重新安装地理代码,但它不包括在我的配置文件中。但Geokit是。这两种方法都没有在我的应用程序中实际使用,这让我觉得有可能删除它对它的依赖关系吗?你会如何修复一个丢失的图书馆?我不知道是专门为Geokit做的。但是对于一些宝石,你需要给出一个路径来做库。您可以通过:lib=>'path/to/lib'来实现,例如config.gem'geokit',:lib=>'path/to/geokit'@sam,该路径的根是什么?从我的应用程序来看,
gems/geokit-1.4.1/lib/geokit
嘿,我想你是对的。当我尝试
rake db:create(在/Users/macuser/Sites/application中)无法为{“reconnect”=>false,“encoding”=>“utf8”,“username”=>“rootsies”,“adapter”=>“mysql”,“database”=>“application”,“pool”=>5,“password”=>“angles1234”,“socket”=>“/tmp/mysql.sock”}创建数据库时,字符集:utf8,排序规则:utf8\u general\ci(如果手动设置字符集,请确保具有匹配的排序规则)
我还为root用户和我的用户设置了数据库的权限。你认为我缺少什么?听起来像是数据库连接或权限问题。也许你没有为非root用户创建权限?通过简单地在apache中更新我的LoadModules,rake db:CREATE就可以正常工作了。这些似乎需要升级一段时间64位计算机能够处理它。我为mysql做了arch标志。当我运行rake db:create时,它说它现在已经存在了。这样就可以了。但是如果我执行
rake db:migrate
rake db:test:prepare
script/server
blink更新Apache fixed mysql?哇哦。试试removi因为运行rake会加载您的应用程序,包括环境和初始值设定项,所以会禁用该初始值设定项(/config/initializers/geocode.rb)。