# Getting Username, Password and DB Being Presently Used

**URL:** <https://www.ruby-forum.com/t/getting-username-password-and-db-being-presently-used/105317>\
**Category:** Rails\
**Created:** [May 28, 2007, 7:39pm UTC](https://www.ruby-forum.com/t/getting-username-password-and-db-being-presently-used/105317 "2007-05-28T19:39:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [May 28, 2007, 7:39pm UTC](https://www.ruby-forum.com/t/getting-username-password-and-db-being-presently-used/105317/1 "2007-05-28T19:39:53Z")

</div>

What is the easiest way to get the present username, password and db  
name being used? Is this info being stored in an object?

I want the information to run a mysql command to export data onto  
server using system("')

Thanks 🙂

–  
John K.  
removed\_email\_address@domain.invalid

[http://www.kopanas.com](http://www.kopanas.com)

> **[Canadian University Software Engineering Conference - CUSEC](http://cusec.net/)**
>
> Canadian University Software Engineering Conference is a yearly conference created by students for students.

[http://www.soen.info](http://www.soen.info)

---

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [May 28, 2007, 8:17pm UTC](https://www.ruby-forum.com/t/getting-username-password-and-db-being-presently-used/105317/2 "2007-05-28T20:17:00Z")

</div>

ActiveRecord::Base.configurations will return a hash that has the  
information you need. ActiveRecord::Base.configurations[‘test’], for  
example, will return the DB settings for your test environment.

- Gabriel

---

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [September 25, 2007, 11:04pm UTC](https://www.ruby-forum.com/t/getting-username-password-and-db-being-presently-used/105317/3 "2007-09-25T23:04:14Z")

</div>

The constant RAILS\_ENV has the current environment.

- Gabriel

---

<div class="post-metadata">

**Author:** ![johnk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/59ef9b/32.png) [@johnk](https://www.ruby-forum.com/u/johnk)\
**Post date:** [September 25, 2007, 11:04pm UTC](https://www.ruby-forum.com/t/getting-username-password-and-db-being-presently-used/105317/4 "2007-09-25T23:04:25Z")

</div>

ahhh… very cool… now how do I know which environment I am in? 🙂

On 5/28/07, John K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > On 5/28/07, John K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > 
> > > John K.
> 
> –  
> John K.  
> removed\_email\_address@domain.invalid
> 
> [http://www.kopanas.com](http://www.kopanas.com)  
> [http://www.cusec.net](http://www.cusec.net)  
> [http://www.soen.info](http://www.soen.info)

–  
John K.  
removed\_email\_address@domain.invalid

[http://www.kopanas.com](http://www.kopanas.com)

> **[Canadian University Software Engineering Conference - CUSEC](http://cusec.net/)**
>
> Canadian University Software Engineering Conference is a yearly conference created by students for students.

[http://www.soen.info](http://www.soen.info)
