# How to connect to existing db?

**URL:** <https://www.ruby-forum.com/t/how-to-connect-to-existing-db/144906>\
**Category:** Rails\
**Created:** [August 4, 2008, 8:43am UTC](https://www.ruby-forum.com/t/how-to-connect-to-existing-db/144906 "2008-08-04T08:43:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jalopy55](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ed8c4c/32.png) [@jalopy55](https://www.ruby-forum.com/u/jalopy55)\
**Post date:** [August 4, 2008, 8:43am UTC](https://www.ruby-forum.com/t/how-to-connect-to-existing-db/144906/1 "2008-08-04T08:43:24Z")

</div>

this is what i’m putting into putty to create the db.

]$ mysqladmin create bean\_development  
mysqladmin: connect to server at ‘localhost’ failed

I’m using ruby through a shared server from hostmonster. i have a db  
&user set up through the cpanel system already.

how do i connect to my existing db?

---

<div class="post-metadata">

**Author:** ![jalopy55](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ed8c4c/32.png) [@jalopy55](https://www.ruby-forum.com/u/jalopy55)\
**Post date:** [August 4, 2008, 9:36am UTC](https://www.ruby-forum.com/t/how-to-connect-to-existing-db/144906/2 "2008-08-04T09:36:11Z")

</div>

Hi

On 4 Sie, 08:43, Jurgis L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> this is what i’m putting into putty to create the db.
> 
> ]$ mysqladmin create bean\_development  
> mysqladmin: connect to server at ‘localhost’ failed

You mean, you wanted to connect to database from shell using:

$ mysql -p -u username bean\_development

?

where username is your user name and you’ll be asked for password.  
This is provided that database is on the same host that you log into  
via Putty. If database is on different host then you’ll have to  
specify remote host with “-h” parameter.

> I’m using ruby through a shared server from hostmonster. i have a db  
> &user set up through the cpanel system already.
> 
> how do i connect to my existing db?

Now ,if in Rails, you have to edit your config/database.yml file to  
provide database access details.

---

<div class="post-metadata">

**Author:** ![jalopy55](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ed8c4c/32.png) [@jalopy55](https://www.ruby-forum.com/u/jalopy55)\
**Post date:** [August 5, 2008, 6:38am UTC](https://www.ruby-forum.com/t/how-to-connect-to-existing-db/144906/3 "2008-08-05T06:38:28Z")

</div>

Thing is… I have sqlite3-ruby installed. This is what my db config  
file shows:

# Warning: The database defined as “test” will be erased and

# re-generated from your development database when you run “rake”.

# Do not set this db to the same as development or production.

test:  
adapter: sqlite3  
database: db/test.sqlite3  
timeout: 5000

there is also a sqlite3 db for production and development. Is this it?  
Do I need to be at all concerned about my external mySQL db? It’s not  
necessary for me to use the external DB, I just thought it might  
simplify things.

Seeing this is the case, should I go any further or leave this config  
alone?

If it is left alone… where can I view the db?

I’m a newbie, so pardon my ignorance. I am learning more as I go along!

Hubert ÅÄ™picki wrote:

> Hi
> 
> On 4 Sie, 08:43, Jurgis L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > this is what i’m putting into putty to create the db.
> > 
> > ]$ mysqladmin create bean\_development  
> > mysqladmin: connect to server at ‘localhost’ failed
> 
> You mean, you wanted to connect to database from shell using:
> 
> $ mysql -p -u username bean\_development
> 
> ?
> 
> where username is your user name and you’ll be asked for password.  
> This is provided that database is on the same host that you log into  
> via Putty. If database is on different host then you’ll have to  
> specify remote host with “-h” parameter.
> 
> > I’m using ruby through a shared server from hostmonster. i have a db  
> > &user set up through the cpanel system already.
> > 
> > how do i connect to my existing db?
> 
> Now ,if in Rails, you have to edit your config/database.yml file to  
> provide database access details.
