# Insertion failed in remote database

**URL:** <https://www.ruby-forum.com/t/insertion-failed-in-remote-database/83064>\
**Category:** Rails\
**Created:** [January 23, 2007, 1:47pm UTC](https://www.ruby-forum.com/t/insertion-failed-in-remote-database/83064 "2007-01-23T13:47:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![truptibhatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8c91f0/32.png) [@truptibhatt](https://www.ruby-forum.com/u/truptibhatt)\
**Post date:** [January 23, 2007, 1:47pm UTC](https://www.ruby-forum.com/t/insertion-failed-in-remote-database/83064/1 "2007-01-23T13:47:01Z")

</div>

I am trying to connect to remote MySQL server through rails. It is able  
to create table through db:migrate. but it gives following error  
can not connect to local mysql server through socket

while inserting data. we are trying to insert data through rhtml form .

i.e.

controller

SubController  
def r\_save  
@sub = Sub.new  
@sub.name = params[:sub][:name]  
end  
@sub.save

end

plz. help me to solve the query…  
we have made necessary correction in database.yml

---

<div class="post-metadata">

**Author:** ![truptibhatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8c91f0/32.png) [@truptibhatt](https://www.ruby-forum.com/u/truptibhatt)\
**Post date:** [January 23, 2007, 5:13pm UTC](https://www.ruby-forum.com/t/insertion-failed-in-remote-database/83064/2 "2007-01-23T17:13:09Z")

</div>

Are you using a different connection in config/database.yml? If you’re  
trying to connect to a local database, it means that the host is set to  
localhost. Make sure that all of your connection settings are correct in  
your database config. If you think they are all correct, post the  
contents of that file here.
