开发者

Welcome aboard ActiveRecord::ConnectionNotEstablished

开发者 https://www.devze.com 2023-04-08 17:42 出处:网络
I\'m using Ubuntu, with Rails 3.0.1 with mysql2 socket. When i do runing install, rake开发者_运维问答 db:create and after rails server, my Welcome aboard, shows ActiveRecord::ConnectionNotEstablished

I'm using Ubuntu, with Rails 3.0.1 with mysql2 socket.

When i do runing install, rake开发者_运维问答 db:create and after rails server, my Welcome aboard, shows ActiveRecord::ConnectionNotEstablished in About your application’s environment

What i do?


Had the same problem on rails 3.1.1:
rake db:create - ok
rails console and some DMLs - ok
but accessing info from the web-page resulted in ActiveRecord::ConnectionNotEstablished.
A rails server restart helped.


It sounds like your MySQL server isn't running. You'll need to install MySQL if you haven't already (apt-get install mysql-server should do it). Once it's running, you'll need to set up a user and database for your app, and note the username and password so that you can put that information in config/database.yml within your app.

This link will be useful if you need any help with those steps.


You'll need to do some more debugging to work it out. How are you running your server?

Make yourself a model. rails generate model Something name:string

Then try running rake db:migrate

Does this work?

If it does, then you must be running your server in a different way (maybe you're running it in production mode?)

Try rails console and try to do Something.count

If all of those work then I'd suggest you try restarting your server.

rails server

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号