# New Application

**URL:** <https://www.ruby-forum.com/t/new-application/182001>\
**Category:** Rails\
**Created:** [January 21, 2010, 11:35am UTC](https://www.ruby-forum.com/t/new-application/182001 "2010-01-21T11:35:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mercurius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mercurius](https://www.ruby-forum.com/u/mercurius)\
**Post date:** [January 21, 2010, 11:35am UTC](https://www.ruby-forum.com/t/new-application/182001/1 "2010-01-21T11:35:00Z")

</div>

I’ve created a new application from scratch on a new development  
machine. I’ve installed Ruby, Rails and MySQL using as many defaults as  
possible.

I’m receiving the following error

> Mysql::Error: query: not connected: INSERT INTO `posts`

when I try to add a new post to my database.

My database.yml development settings looks like

> development:  
> database: blog\_development  
> adapter: mysql  
> host: 127.0.0.1  
> username: root  
> password:  
> socket: /tmp/mysql.sock

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![mercurius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mercurius](https://www.ruby-forum.com/u/mercurius)\
**Post date:** [January 21, 2010, 11:40am UTC](https://www.ruby-forum.com/t/new-application/182001/2 "2010-01-21T11:40:24Z")

</div>

Am 21.01.2010 um 11:35 schrieb Pale H.:

> My database.yml development settings looks like
> 
> > development:  
> > database: blog\_development  
> > adapter: mysql  
> > host: 127.0.0.1  
> > username: root  
> > password:  
> > socket: /tmp/mysql.sock
> 
> What am I doing wrong?

Two things that come to mind:

1. Did the migration creating the posts in the db run through correctly?
2. Did you start your “rails server” (be it script/server, passenger or  
whatever) in development mode?

Felix

---

<div class="post-metadata">

**Author:** ![mercurius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mercurius](https://www.ruby-forum.com/u/mercurius)\
**Post date:** [January 21, 2010, 11:45am UTC](https://www.ruby-forum.com/t/new-application/182001/3 "2010-01-21T11:45:59Z")

</div>

Felix SchÃ¤fer wrote:

> Am 21.01.2010 um 11:35 schrieb Pale H.:
> 
> > My database.yml development settings looks like
> > 
> > > development:  
> > > database: blog\_development  
> > > adapter: mysql  
> > > host: 127.0.0.1  
> > > username: root  
> > > password:  
> > > socket: /tmp/mysql.sock
> > 
> > What am I doing wrong?
> 
> Two things that come to mind:
> 
> 1. Did the migration creating the posts in the db run through correctly?
> 2. Did you start your “rails server” (be it script/server, passenger or  
> whatever) in development mode?
> 
> Felix

In response to 1. The migration ran fine. I thought I’d repaired a  
similar error when I previously tried to run the migration by changing  
the client library in /bin. Could this be the problem?

In response to 2. I initiated the server with ruby script/server  
command. I would presume it’s running in development mode as the  
application is reloaded on page refresh.

Any thoughts?

---

<div class="post-metadata">

**Author:** ![mercurius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mercurius](https://www.ruby-forum.com/u/mercurius)\
**Post date:** [January 21, 2010, 12:52pm UTC](https://www.ruby-forum.com/t/new-application/182001/4 "2010-01-21T12:52:24Z")

</div>

Hello Pale,

You need to install gem for mysql.

gem install mysql

also if you are running your app at local machine then use ‘localhost’  
as  
host.

try to make make your development config like

development:  
adapter: mysql  
encoding: utf8  
reconnect: false  
database: test\_development  
pool: 5  
username: root  
password: root  
host: localhost

Thanks & Regards  
Ankit Varshney

---

<div class="post-metadata">

**Author:** ![mercurius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mercurius](https://www.ruby-forum.com/u/mercurius)\
**Post date:** [January 21, 2010, 1:02pm UTC](https://www.ruby-forum.com/t/new-application/182001/5 "2010-01-21T13:02:30Z")

</div>

Ankit Varshney wrote:

> Hello Pale,
> 
> You need to install gem for mysql.
> 
> gem install mysql
> 
> also if you are running your app at local machine then use ‘localhost’  
> as  
> host.
> 
> try to make make your development config like
> 
> development:  
> adapter: mysql  
> encoding: utf8  
> reconnect: false  
> database: test\_development  
> pool: 5  
> username: root  
> password: root  
> host: localhost
> 
> Thanks & Regards  
> Ankit Varshney

Thank you for your response.

I’ve already installed the MySQL gem so that’s not the issue. localhost  
or the address I specified are both fine to use as the host. I even went  
as far back as to ensure a database existed (despite my migration  
running without a problem).

To solve the issue, I replaced the client library and restarted my  
server.
