I'm on OS X 10.5.8 with the up-to-date Rails. I'm trying to get
restful_authentication to work, but I keep getting a mysql error. I've
done the re-install mysql thing.
[terminal]
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/Applications/MAMP/htdocs/Rails/restful_authentication_tutorial/vendor/
rails/activerecord/lib/active_record/connection_adapters/
mysql_adapter.rb:576:in `real_connect': Can't connect to local MySQL
server through socket '/var/run/mysqld/mysqld.sock' (2) (Mysql::Error)
from /Applications/MAMP/htdocs/Rails/restful_authentication_tutorial/
vendor/rails/activerecord/lib/active_record/connection_adapters/
mysql_adapter.rb:576:in `connect'
from /Applications/MAMP/htdocs/Rails/restful_authentication_tutorial/
vendor/rails/activerecord/lib/active_record/connection_adapters/
mysql_adapter.rb:204:in `initialize'
from /Applications/MAMP/htdocs/Rails/restful_authentication_tutorial/
vendor/rails/activerecord/lib/active_record/connection_adapters/
mysql_adapter.rb:76:in `new'
from /Applications/MAMP/htdocs/Rails/restful_authentication_tutorial/
vendor/rails/activerecord/lib/active_record/connection_adapters/
mysql_adapter.rb:76:in `mysql_connection'
from /Applications/MAMP/htdocs/Rails/restful_authentication_tutorial/
vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/connection_pool.rb:223:in `send'
from /Applications/MAMP/htdocs/Rails/restful_authentication_tutorial/
vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/connection_pool.rb:223:in `new_connection'
from /Applications/MAMP/htdocs/Rails/restful_authentication_tutorial/
vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/connection_pool.rb:245:in `checkout_new_connection'
from /Applications/MAMP/htdocs/Rails/restful_authentication_tutorial/
vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/connection_pool.rb:188:in `checkout'
... 26 levels...
from /Applications/MAMP/htdocs/Rails/restful_authentication_tutorial/
vendor/rails/railties/lib/commands/server.rb:84
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`require'
from script/server:3
[/terminal]
I'm on OS X 10.5.8 with the up-to-date Rails. I'm trying to get
restful_authentication to work, but I keep getting a mysql error. I've
done the re-install mysql thing.
Where does MAMP keep its mysql socket ? If it's not /var/run/mysqld
then change your database.yml so that it points at the right place.
Thanks for the advice, I had that "duh" moment when I read it...having
my Rails apps in the MAMP folder messed up the mysql settings.
I moved my Rails app to the Sites folder on my Mac, I was able to get
mysql to work. Now I'm having problems with my settings somewhere, my
browser is giving me this message:
[browser message]
ActiveRecord::StatementInvalid in Root#index
Showing app/views/root/index.html.erb where line #5 raised:
Mysql::Error: Table 'DEV.invitations' doesn't exist: SHOW FIELDS FROM
`invitations`
Extracted source (around line #5):
2: <% unless logged_in? -%><% if_in_beta? do -%>
3: <%= error_messages_for :invitation %>
4: <p>We are currently in private beta. Please enter your email
address below and we will let know when an invitation becomes
available.</p>
5: <% uberform_for [:user, Invitation.new] do |f| -%>
6: <%= f.text_field :email, :label => "Your Email:" %>
7: <%= f.submit 'Submit' %>
8: <% end -%>
[/browser message]
I have some null values in my database, could that be the source of my
issue?
If this is your dev environment I would drop the database and just do
a clean new rake db:migrate. It's trying to insert the user devuser
that I'm assuming is already in the database or your migration files
tries to insert the user twice... hard to say without the full --trace
output from the command...
Try to drop the db and re-run the migration that would be what I would
do..
@Kevin. Did you use rake db:migrate to build your database? I think
hemidull was recommending to drop the schema and redo it. But if you
are building your database externally, then the error shown above
means that the table doesn't exist. If table does exist, it means
your database.yml configuration file is pointing to the wrong schema.
@Mukund To answer your question:
Yes, I used db:migrate to build the database, then I used phpmyadmin
to see what the result was, I'm new to rails programming and thought
it would be useful to examine the result.
I think I have the connection to the database correct, the problem
appears (to me) to be in the setup before I migrate.
I'm doing the restful_authentication with all the bells & whistles
tutorial. I started over again to go from the beginning. When I get to
the migration I get an error, here's the initial error and the full
trace: