帮助设置Ruby on Rails和MySQL-提供了奖励 [英] Help Setting up Ruby on Rails and MySQL - Reward Offered
问题描述
我非常需要那里的任何慈善红宝石/铁轨专家的帮助.我真的很想学习RoR,但是我什么也做不了,因为每次进入需要连接数据库的阶段时,都会有些混乱.这就是我现在要去的事情.
I am desperately in need of help from any charitable ruby/rails experts out there. I really want to learn RoR, but I can't get anywhere because every time I get to the stage where I need to connect to the database, something is messed up. Here's what I've got going at the moment.
[Mac OSX 10.6.6- Ruby 1.9.2- Rails 3.0.5- MySQL 5.5.10]
[ Mac OSX 10.6.6 -- Ruby 1.9.2 -- Rails 3.0.5 -- MySQL 5.5.10 ]
所有这些都是最新版本,全新安装且运行平稳.我也安装了rvm.我只想知道如何使用MySQL数据库建立一个新的Rails项目并正确连接到它.我花了无数小时来回搜寻,一次又一次地出错.
All of these are the latest versions, freshly installed, and running smoothly. I also have rvm installed. All I want to know is how I can set up a new Rails project using a MySQL database and connect to it properly. I have spent countless hours googling around and getting error after error after error.
任何人都可以通过逐步说明如何将正在运行的Rails项目连接到mysql数据库来帮助我吗?如果有人可以帮助我,我不仅会欠你一生,而且我将免费为您提供出色的Web和界面设计,和/或以UI设计师的身份参与下一个项目.另外,我将为您提供终身免费的Photoshop/图像建议.
Can anyone help me out by outlining step by step how I can just get a working rails project connected to a mysql database? If anyone can help me with this I will not only owe you my life, but I will make amazing web and interface designs for you for free and/or collaborate on your next project as a UI designer. I will in addition give you free photoshop/graphics advising for life.
我想学习这么糟糕的Rails,但是现在我对这种文件配置的东西不屑一顾,浪费了大量的时间.请帮忙!
I want to learn rails so so bad, but I am in over my head right now with this file configuration stuff and wasting massive amounts of time. Please help!
推荐答案
您将欠我一生!!!哇!认真尝试一下:
You'll owe me your life!!!! WOW! Seriously, try this:
rails new example -d mysql
config.database.yml已创建
config.database.yml created
development:
adapter: mysql2
encoding: utf8
database: example_development
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
进入您的新项目
cd example
然后安装所需的gems(mysql2)
Then install gems needed (mysql2)
bundle install
然后创建您的数据库
rake db:create
利润!
如果您不能使用/var/run/mysqld/mysqld.sock作为连接到mysql的指针,请对其进行编辑以使其类似于
If you can't use /var/run/mysqld/mysqld.sock as a pointer to connect to your mysql, then edit it to look like this https://gist.github.com/878434 and customize the port and username/password
这篇关于帮助设置Ruby on Rails和MySQL-提供了奖励的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!