简体   繁体   English

帮助设置Ruby on Rails和MySQL - 提供奖励

[英]Help Setting up Ruby on Rails and MySQL - Reward Offered

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. 我真的很想学习RoR,但是我无法到达任何地方,因为每次我到达需要连接数据库的阶段时,都会出现问题。 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]

All of these are the latest versions, freshly installed, and running smoothly. 所有这些都是最新版本,新安装,运行顺畅。 I also have rvm installed. 我也安装了rvm。 All I want to know is how I can set up a new Rails project using a MySQL database and connect to it properly. 我想知道的是如何使用MySQL数据库建立一个新的Rails项目并正确连接到它。 I have spent countless hours googling around and getting error after error after error. 我花了无数个小时谷歌搜索并在错误后出错后收到错误。

Can anyone help me out by outlining step by step how I can just get a working rails project connected to a mysql database? 任何人都可以通过逐步概述如何让一个工作的rails项目连接到mysql数据库来帮助我吗? 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. 如果有人能帮助我,我将不仅仅欠你我的生命,而且我会为你免费制作出令人惊叹的网页和界面设计,并/或者作为UI设计师在你的下一个项目上进行合作。 I will in addition give you free photoshop/graphics advising for life. 我还将为您提供免费的photoshop /图形建议。

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. 我想学习如此糟糕的rails,但我现在正处于这个文件配置的东西,并浪费了大量的时间。 Please help! 请帮忙!

You'll owe me your life!!!! 你欠我一生!!!! WOW! 哇! Seriously, try this: 说真的,试试这个:

rails new example -d mysql

config.database.yml created config.database.yml已创建

development:
  adapter: mysql2  
  encoding: utf8
  database: example_development
  pool: 5
  username: root
  password:
  socket: /var/run/mysqld/mysqld.sock

Go into your new project 进入你的新项目

cd example

Then install gems needed (mysql2) 然后安装所需的宝石(mysql2)

bundle install

Then create your database 然后创建数据库

rake db:create

Profit! 利润!

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 如果你不能使用/var/run/mysqld/mysqld.sock作为连接你的mysql的指针,那么编辑它看起来像这样https://gist.github.com/878434并自定义端口和用户名/密码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM