Connection to database

Hi everyone,

Can someone suggest me is there any way in RoR to check for the database
connection without using database.yml.

I need this because before editing database.yml file i want to check
whether mysql is installed in the given host.

Any help would be greatly appreciated.

irb -r active_record

irb(main):001:0>
ActiveRecord::Base.establish_connection(:adapter=>mysql, :database=>my_db, :username=>my_user, :pass=>my_pass)

Anandh Kumar wrote in post #969995:

Hi everyone,

Can someone suggest me is there any way in RoR to check for the database
connection without using database.yml.

I need this because before editing database.yml file i want to check
whether mysql is installed in the given host.

Search the filesystem for mysqld or something. Or ask the sysadmin.

Any help would be greatly appreciated.

Best,

Anandh Kumar wrote in post #969995:

Can someone suggest me is there any way in RoR to check for the database
connection without using database.yml.

I need this because before editing database.yml file i want to check
whether mysql is installed in the given host.

Which Operating system ?

HTH,

Peter

Hi,

- first check MySQL console,
- then 'gem list m' - you can see here every gem listed starts with
letter 'm' (or simply 'gem list')
- then what other wrote here 'irb -r active_record'.

If your Euby, Gem, Rails installed well, you have the necessary gems
(see in gem list), then you can edit your Gemfile, then run bundle
install, then edit .yaml. I think just give a try, you cannot loose
much in early stage.
Good luck,
gezope