Hi,

I'm new to Rails and can't seem to get it working with MySQL.

I am running Ruby 1.9.3, Rails 3.1.3, and MySQL 5.5.17 (windows 7
64bit).

I create the most basic rails project (rails generate demo index,
uncomment the last line of the routs.rb file), run the sever and
navigate to page and get:

ActiveRecord::ConnectionNotEstablished

ActiveRecord::ConnectionNotEstablished

Rails.root:
C:/Users/sdeese/Desktop/RailsPractice/RailsApplication6/RailsApplication6
Application Trace | Framework Trace | Full Trace

Request

Parameters:

None

Show session dump

Show env dump
Response

Headers:

None




Can anyone help me?

thanks

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Colin Law at Dec 6, 2011 at 8:58 pm

    On 6 December 2011 20:42, stephen d. wrote:
    Hi,

    I'm new to Rails and can't seem to get it working with MySQL.

    I am running Ruby 1.9.3, Rails 3.1.3, and MySQL 5.5.17 (windows 7
    64bit).

    I create the most basic rails project (rails generate demo index,
    uncomment the last line of the routs.rb file), run the sever and
    navigate to page and get:

    ActiveRecord::ConnectionNotEstablished
    Some questions:

    Have you setup the database name username and password in database.yml?

    Have you created the database
    rake db:create
    and run the migrations (if any)
    rake db:migrate

    Are you able to access the database using whatever mysql interface is
    available for windows?

    Note that rails expects there to be a database even if you have not
    got any tables in it yet.

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Stephen d. at Dec 7, 2011 at 2:24 am

    Colin Law wrote in post #1035428:
    On 6 December 2011 20:42, stephen d. wrote:

    ActiveRecord::ConnectionNotEstablished
    Some questions:

    Have you setup the database name username and password in database.yml?

    Have you created the database
    rake db:create
    and run the migrations (if any)
    rake db:migrate

    Are you able to access the database using whatever mysql interface is
    available for windows?

    Note that rails expects there to be a database even if you have not
    got any tables in it yet.

    Colin
    I've honestly spent 2 days trying just about every piece of advice on
    the internet. The bottom line is that the latest version of Ruby,
    Rails, and MySql do not work together. Or if they do, nobody knows how
    to make them do so.

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Hassan Schroeder at Dec 7, 2011 at 4:03 am

    On Tue, Dec 6, 2011 at 6:24 PM, stephen d. wrote:

    I've honestly spent 2 days trying just about every piece of advice on
    the internet.  The bottom line is that the latest version of Ruby,
    Rails, and MySql do not work together.  Or if they do, nobody knows how
    to make them do so.
    Minus a few thumb-fingered mis-types and sanity checks:

    521 rvm install ruby-1.9.3-preview1
    522 rvm use 1.9.3
    523 rvm gemset create 3.1.3
    524 rvm use 1.9.3@3.1.3
    526 gem install rails -v=3.1.3
    528 rails new swamp -d mysql
    529 cd swamp
    535 vi config/database.yml
    536 rake db:create
    540 rails g resource thing name:string age:integer
    541 rake db:migrate
    544 vi app/controllers/things_controller.rb
    546 vi app/views/things/index.html.erb
    547 rails s

    ...and... lights! camera! action!

    mysqld Ver 5.1.41 for apple-darwin9.5.0 on i386 (MySQL Community Server (GPL))

    Apparently it *does* work. And maybe if you responded to the specific
    questions already posed by Colin Law, we could help you past whatever
    is not working in your environment.

    Just sayin' ...
    --
    Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
    http://about.me/hassanschroeder
    twitter: @hassan

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Michael Pavling at Dec 7, 2011 at 8:57 am

    On 7 December 2011 04:03, Hassan Schroeder wrote:
    On Tue, Dec 6, 2011 at 6:24 PM, stephen d. wrote:

    The bottom line is that the latest version of Ruby,
    Rails, and MySql do not work together.

    Apparently it *does* work.

    Just sayin' ...
    yes, but sweeping declarative statements are never going to be a good
    starting point for taking advice :-/

    Stephen, how about modifying your assertion thus, which may be a
    better place to start reflection:

    "The bottom line is that I can't get the latest version of Ruby,
    Rails, and MySql running on Windows"


    PS in your OP, you say:
    "I create the most basic rails project (rails generate demo index,
    uncomment the last line of the routs.rb [sic] file), run the sever and
    navigate to page and get:"

    ...but you don't mention in that list any changes you made to the
    database.yml file.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Luis Lavena at Dec 7, 2011 at 5:35 pm

    On Dec 7, 5:57 am, Michael Pavling wrote:
    Stephen, how about modifying your assertion thus, which may be a
    better place to start reflection:

    "The bottom line is that I can't get the latest version of Ruby,
    Rails, and MySql running on Windows"

    PS in your OP, you say:
    "I create the most basic rails project (rails generate demo index,
    uncomment the last line of the routs.rb [sic] file), run the sever and
    navigate to page and get:"

    ...but you don't mention in that list any changes you made to the
    database.yml file.
    Neither if using the MySQL command line client does indeed connect.

    Without knowing if MySQL *works* we are just guessing any possible
    cause.

    --
    Luis Lavena

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Stephen d. at Dec 7, 2011 at 7:14 pm

    Michael Pavling wrote in post #1035507:
    On 7 December 2011 04:03, Hassan Schroeder wrote:
    On Tue, Dec 6, 2011 at 6:24 PM, stephen d. wrote:

    The bottom line is that the latest version of Ruby,
    Rails, and MySql do not work together.

    Apparently it *does* work.

    Just sayin' ...
    yes, but sweeping declarative statements are never going to be a good
    starting point for taking advice :-/

    Stephen, how about modifying your assertion thus, which may be a
    better place to start reflection:

    "The bottom line is that I can't get the latest version of Ruby,
    Rails, and MySql running on Windows"


    PS in your OP, you say:
    "I create the most basic rails project (rails generate demo index,
    uncomment the last line of the routs.rb [sic] file), run the sever and
    navigate to page and get:"

    ...but you don't mention in that list any changes you made to the
    database.yml file.
    I appologize and agree. It was the end of two full days of frustrations
    and I should have been more polite to those who were taking their
    valuable time to try and help me.

    I am new to the world of Rails and began by installing all the latest
    versions of things: Ruby 1.9.3, Rails 3.1.3, and MySQL 5.5.17 (Windows
    7 64 bit).

    I did a few tutoritals using SQLite and it is indeed very nice.
    However, I know that I will need to use Rails with MySQL for production,
    therefore I need to go ahead and get used to it while learning.

    Coming from the C#/Silverlight development world where things are highly
    integrated and just work, I'm finding that the promise that Ruby on
    Rails is fast and fun to be untrue(and I know this will bring much
    flack.. but its true). I asked my colleque (a very experienced developer
    as well) to try to do a "hello world" application in rails using MySQL..
    after many many hours of installing, reinstalling, reading blogs, etc..
    no bananana. Honestly, I find that very disappoining.

    I will try the detailed advice above (thank you for it) and let you guys
    know what happens. If i get it working, I will put up a detailed
    article on a blog so as to save the next poor newbie. However, the fact
    that it is necessary is truly sad. It is what I hate about open source.

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Colin Law at Dec 7, 2011 at 8:43 pm

    On 7 December 2011 19:14, stephen d. wrote:
    ...
    Coming from the C#/Silverlight development world where things are highly
    integrated and just work, I'm finding that the promise that Ruby on
    Rails is fast and fun to be untrue(and I know this will bring much
    flack.. but its true). I asked my colleque (a very experienced developer
    as well) to try to do a "hello world" application in rails using MySQL..
    after many many hours of installing, reinstalling, reading blogs, etc..
    no bananana.  Honestly, I find that very disappoining.

    I will try the detailed advice above (thank you for it) and let you guys
    know what happens.  If i get it working, I will put up a detailed
    article on a blog so as to save the next poor newbie.  However, the fact
    that it is necessary is truly sad.  It is what I hate about open source.
    One of the issues is that you are using Windows. Most rails
    developers use Linux (often Ubuntu) or Mac. I understand that
    generally life is trickier with rails in Windows. I use Ubuntu and
    have had few such problems. In addition most here do not have
    experience with Windows so there are not so many who can offer advice.
    If you have to use windows then I gather that railsinstaller is the
    way to go. My advice, though, would be to move to Linux or Mac if at
    all possible. Others may not agree.

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Craig White at Dec 7, 2011 at 10:18 pm

    On Dec 7, 2011, at 12:14 PM, stephen d. wrote:

    I appologize and agree. It was the end of two full days of frustrations
    and I should have been more polite to those who were taking their
    valuable time to try and help me.

    I am new to the world of Rails and began by installing all the latest
    versions of things: Ruby 1.9.3, Rails 3.1.3, and MySQL 5.5.17 (Windows
    7 64 bit).

    I did a few tutoritals using SQLite and it is indeed very nice.
    However, I know that I will need to use Rails with MySQL for production,
    therefore I need to go ahead and get used to it while learning.

    Coming from the C#/Silverlight development world where things are highly
    integrated and just work, I'm finding that the promise that Ruby on
    Rails is fast and fun to be untrue(and I know this will bring much
    flack.. but its true). I asked my colleque (a very experienced developer
    as well) to try to do a "hello world" application in rails using MySQL..
    after many many hours of installing, reinstalling, reading blogs, etc..
    no bananana. Honestly, I find that very disappoining.

    I will try the detailed advice above (thank you for it) and let you guys
    know what happens. If i get it working, I will put up a detailed
    article on a blog so as to save the next poor newbie. However, the fact
    that it is necessary is truly sad. It is what I hate about open source.
    ----
    I'm going to respond but recognize that this is simply my view and I am reasonably sure it isn't universally shared.

    Rails has a whole lot going for it - primarily the ruby language and the code structures inured by the language itself. It's reasonably simple to view the code months/years later and know what it does, relatively simple to structure and it's object oriented so beautifully that it completely lends itself to modularity.

    The Rails framework has incorporated the best of programming principles bringing into play integrated testing, MVC, sensible class structures, etc.

    Owing no doubt to the incredible success of Rails, there has been continual refactoring to the point where there is a large amount of fragmentation which leads to a whole lot of blogs that have outdated if not inaccurate information and sometimes Googling for solutions can be more problematic than one would believe. Thus if you want to blog about your realizations, by all means go for it but it's entirely possible that 6 months to a year from now, it will be largely irrelevant to the then current version.

    Speaking of versions, Rails has just moved to the latest incarnation which is known as 3.1 and it has some significant changes from earlier versions - especially if you are looking at notions/blogs/code/books that are considering Rails 2.x Thus one of the most important things to track is that if you have chosen a particular book or methodology for learning Rails, you should take care to ensure that the version of rails you use matches the guide.

    Colin touched upon the notion of Windows and Rails which is always a sore topic. The reality is that most of the ruby gems, most of the requisite libraries tend to be built on the fly where Macintosh & Linux come with the GCC/C++ compiler and Windows sort of relies upon having binaries ready to roll. Worse is that the original developers seemed to be all Macintosh users who developed on Mac's and deployed on Linux and Windows support has been relegated to a relatively smaller number of people which has caused some lag. Then Ruby on Windows seems to gag when installed/run from paths with spaces in them and is just generally slower which also becomes a disincentive.

    So I think it is fair to say that at this point, there is a relatively high barrier to use for Windows users and generally the recommendation is if possible, run a VMWare or VirtualBox install of some Linux... not because it's dead simple to get going (it isn't) but the barriers are lessened. Also - FWIW - I think a majority of Rails developers started with the AWDWROR (Agile Web Development With Ruby on Rails) book - essentially the Bible for Rails... dead tree form seems to be on 2.x and the latest eDoc I think is up to 3.1 and though it's basic, it is a reasonably fast run through (2 days perhaps) and you have a really good footing for starting out.

    Craig

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Scott Ribe at Dec 7, 2011 at 10:24 pm

    On Dec 7, 2011, at 3:17 PM, Craig White wrote:

    dead tree form seems to be on 2.x
    Latest version is on 3.1; possibly enough of the prior version on 3.0 still in inventories that if you order from anywhere other than publisher, you might get that.

    --
    Scott Ribe
    scott_ribe@elevated-dev.com
    http://www.elevated-dev.com/
    (303) 722-0567 voice




    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Anish at Dec 8, 2011 at 10:14 pm
    I am a newbie too and my 2cents. One mistake I did when trying out
    mysql was in database.yml, I was using mysql driver, but you should
    mention the driver as "mysql2". I hope u are already doing this.
    On Dec 7, 2:24 pm, Scott Ribe wrote:
    On Dec 7, 2011, at 3:17 PM, Craig White wrote:

    dead tree form seems to be on 2.x
    Latest version is on 3.1; possibly enough of the prior version on 3.0 still in inventories that if you order from anywhere other than publisher, you might get that.

    --
    Scott Ribe
    scott_r...@elevated-dev.comhttp://www.elevated-dev.com/
    (303) 722-0567 voice
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Stephen d. at Dec 8, 2011 at 10:38 pm
    Update:

    After 3 days of shear struggle, I got the following combination to work
    together:

    1. Ruby 1.9.2
    2. Rails 3.1.1
    3. MySql 5.5.17 (64 bit)
    4. Windows 7 64 bit

    After reading tons and tons of blogs with advice that didn't work (but
    Thank you to those on here who tried.. for some reason the blogs here
    were more helpful).. and almost getting to the same place as this guy..
    whose post I copy below:

    I’ve been trying to have Rails work with MySQL for 2 days now with no
    positive result. I followed numerous guidelines and read kilobytes of
    forum threads. All in vain.

    Ruby 1.9.2 + Rails 3.1.1 + MySQL 5.5 on 64bit Win7 is Mission
    Impossible.

    --- AND ---

    No, above instructions did not help.

    I’m not wasting any more time on this Ruby crap. Enough is enough.

    ----

    I've found the correct answer:

    see this link:
    http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/

    I must say though, that I'm pretty jaded/bitter about rails. Three long
    days to get "hello world" with MySQL (the most mainstream DB in the
    world) working??? Rails you get an F.

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Colin Law at Dec 9, 2011 at 8:59 am

    On 8 December 2011 22:37, stephen d. wrote:
    I must say though, that I'm pretty jaded/bitter about rails.  Three long
    days to get "hello world" with MySQL  (the most mainstream DB in the
    world) working??? Rails you get an F.
    I feel I have to point out that the issues appear mostly to do with
    mysql and ruby rather than rails. Did you try railsinstaller which I
    am led to believe is the easiest way to get rails (and ruby etc) going
    on Windows?

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Byrnejb at Dec 9, 2011 at 4:43 pm
    Re: MicroSoft Windows, Ruby, and Ruby on Rails (RoR)

    I formerly did a lot of offline development in Rails on a Windows
    XPpro system. I started out using pre-packaged native MS-Win binaries
    but eventually ran into a situation where the available Windows
    package simply did not work following a MicroSoft service pack
    'upgrade' and the package authors could not agree on what was wrong or
    how to fix it.

    At that juncture I switched to Cygwin (http://www.cygwin.com/) and
    stopped fighting against the RoR OSX/Linux based paradigm. If you are
    planning on a lot of RoR development on an MS-Win platform and you
    wish to work with the current versions of the RoR framework and its
    many supporting tools then installing Cygwin and working within its
    shell on MS-Win will make your life as a developer considerably less
    frustrating. Once you have your software working inside Cygwin then
    you can concern yourself with obtaining the minimal number of native
    MS-Win ports required to just run the product when distributed. That
    is a lot easier to accomplish than building and maintaining a complete
    development environment with native MS-Win binaries.

    By the way, switching platforms to BSD/Linux/OSX often means trading
    one form of frustration for another. The unspoken assumption made by
    the adviser when such advice is given is that the recipient will
    undertake to discover any deficiencies in their particular
    distribution of BSD/Linux/OSX, acquire the missing bits, and then
    build those bits themselves. That process can present a very steep
    learning curve to somebody that just wants their development software
    to work. Just finding the appropriate package repositories (yum, apt,
    mac-ports, etc.) for your specific distribution can sometimes pose a
    major hurdle. Cygwin presents somewhat the same difficulty of course
    but, as it is both the repository (via setup.exe) and the environment
    (via the shell), it is the only additional thing that you need learn
    on your Windows host.

    Just a few thoughts for your consideration.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Greg Akins at Dec 10, 2011 at 12:00 am

    On Fri, Dec 9, 2011 at 11:42 AM, byrnejb wrote:
    Re: MicroSoft Windows, Ruby, and Ruby on Rails (RoR)

    I formerly did a lot of offline development in Rails on a Windows
    XPpro system.  I started out using pre-packaged native MS-Win binaries
    Just cleansing myself from a few months of RoR on WindowsXP.
    At that juncture I switched to Cygwin (http://www.cygwin.com/) and
    Cygwin presented some frustrations also. I use Cygwin for somethings,
    but run cmd and native RoR for others. Really drove me notes having
    to work in that environment when I have experience in OSX & Linux.
    By the way, switching platforms to BSD/Linux/OSX often means trading
    one form of frustration for another.
    True, and someone with no *nix experience would probably want to jump
    out a window (no pun intended) if they had to adopt that on top of the
    RoR learning curve.

    It *IS* much better though. Being able to just 'sudo apt-get install
    foo' when you're missing something instead of trying to find,
    download, install and configure is refreshing.

    My solution now is to run Xubuntu on a VirtualBox in my WindowsXp
    machine. Amazingly, Linux feels fasters in a VM than native
    WindowsXP.


    --
    Greg Akins
    http://twitter.com/akinsgre

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 6, '11 at 8:42p
activeDec 10, '11 at 12:00a
posts15
users10
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase