我是Rails新手,当我尝试创建像这样的新应用程序时:
$ rails new app_one -d mysql
它的安装和一切工作都如预期的那样。但是,如果我尝试在启用了MySQL的本地服务器上运行它,它就不能工作。
> /Users/matthewpoplin/.rvm/gems/ruby-2.0.0-p0/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Access denied for user 'root'@'localhost' (using password: NO)
是否有机会让Rails应用程序连接到旧的MySQL v4.1.20服务器?
rails db
命令工作正常,但我无法运行应用程序。
当我生成新应用程序时
rails new app_name -d mysql
我在database.yml文件中看到了以下内容:
MySQL。建议版本4.1和5.0。
这意味着我可以使用它。然而,Rails活动记录使用的是MySQL v.5.0.2+特性():
# Make MySQL reject illegal values rather than truncating or blanking them, see
# http://dev.mysql
使用这个命令"git push dokku master“,在Digital Ocean上使用Dokku部署ruby on rails,得到这个错误 Could not load 'active_record/connection_adapters/mysql_adapter'.
Make sure that the adapter in config/database.yml is valid. If you
use an adapter other than 'mysql2', 'postgresql' or 'sqli
class CreateUsers < ActiveRecord::Migration[6.0]
def change
create_table :users do |t|
t.string :user
t.timestamps
end
end
end
class CreateArticles < ActiveRecord::Migration[6.0]
def change
create_table :articles do |t|
t.string :content
t.timestam
当我在生产服务器上检查Rails的时间时
$ rails console production
$ Time.now # good time
论Mysql的生产
mysql > select now(); # good time
但是,在我将任何记录保存到数据库后,"created_at“和"updated_at”字段都比当前时间-2小时。这里怎么了?
我已经重新启动mysql,nginx后,时间改变。接下来我能做什么?Mysql的Rails是否为这些字段定义了时间?
我有一个名为"enrollment_app“的Rails应用程序,它用一个MySQL种子文件初始化和填充数据库中的所有表。我创建了这个应用程序,添加了一些迁移,并将我的应用程序推到Heroku。但是,由于Heroku使用Postgres,我需要一种方法使我的MySQL数据库与Heroku兼容,所以我使用了ClearDB插件。
不过,当我试图打开这个应用程序时,我会收到这样的信息:
Application Error
An error occurred in the application and your page could not be served. Please try aga
我是Ruby和Rails的新手,也是第一次设置项目。每次我尝试启动WEBrick服务器时,它都会启动,然后关闭。任何帮助都将不胜感激。似乎我需要提供密码,但我不确定如何做到这一点。
bkuethen$ rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/bkuethen/.rvm/g
一段时间以来,我一直在努力在我的Mac上安装一个Rails。我所得到的错误(在我的开发日志中)是:
Status: 500 Internal Server Error no such file to load -- mysql
以下是一些信息:
我可以成功地rake db :迁移我的application.I've安装了mysql gem,它出现在创业板列表中: MySQL (2.8.1)。,我已经安装了乘客。错误来自于我们生产的现有的rails应用程序--一个新的Rails应用程序--一个新的Rails应用程序,一个新的MySQL db(使用mysqladmin -uroot cre
我在我的windows7机器上安装了xampp。现在我想使用Ruby on Rails。为此,我先安装了Ruby,然后使用命令提示符安装了rails。
现在的问题是,我不知道如何将现有的xampp安装与ruby on rails集成在一起,这样我就可以使用Apache服务器和MySQL数据库。
我不想安装MySQL和其他一些网络服务器,因为这会给我带来很多问题。因此,请指导我应该使用的任何修复程序,使来自xampp的apache和MySQL能够与Ruby on Rails一起工作。
我是Rails的新手。我试图用这个网站的答案来解决我的问题,但是失败了。
1.我的配置
Window 7 64bit
ruby 1.9.3p484
rails 4.0.2
mysql server 5.0.91-community-nt (32bit)
mysql gem
I set a password for root in mysql configuration
2.我创建了一个新的应用程序
rails new my_cms -d mysql
我做了两个改变
在Gemfile中,我使用mysql而不是mysql2
内部配置/database.yml我使用mysql而不是mysql
有谁能解释一下为什么这个应用程序在生产模式和开发模式上的表现不同?我已经检查和重新检查config/database.yml,并确保用户名和密码是正确的.事实上,在编写这篇文章时,我已经将开发和生产数据库设置为相同的。然而,当我在生产环境中运行服务器时,Mysql2抱怨访问被拒绝,但在开发环境中工作良好。
在运行rails c production和rails c development时也会发生同样的情况,开发中没有错误,但是在生产中Mysql2访问被拒绝。
生产方式
$ rails s -e production
=> Booting WEBrick
=> Rails 4.0.