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

发布于 2024-09-28 09:18:09 字数 4868 浏览 4 评论 0原文

不太确定该怎么做。

我的应用程序的database.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,然后在内部创建数据库application-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

Not exactly sure how to go about this.

My app's database.yml

development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: application-dev
  pool: 5
  username: root
  password: angles123
  socket: /tmp/mysql.sock

I was thinking that it would be wise to go ahead and mysqladmin -u root --password=angles123, and then once inside create database application-dev, but the -dev part, mysql is not happy about. But Icould create a database that said simply application.

Am I missing someting else possibly?

The reason I am bringing this up is because I get this error whenever I try to rake db:migrate, or script/server

rake db:test:prepare
(in /Users/macuser/Sites/hq_channel)
rake aborted!
uninitialized constant Geocode

So I assumed I set up the database wrong because I clearly have that gem installed.

Here is the full stacktrace :

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谜泪 2024-10-05 09:18:09

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

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

另外,您可以尝试使用 --trace 运行 rake,以更好地了解导致该错误的位置所包含的内容。

I've had mysql installations that didn't allow underscores or dashes in the database names.

You could try changing the database name to application and then running rake db:create to see if it creates your database.

Also, you can try running rake with --trace to get a better idea of what's being included from where that's causing that error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文