Using multiple mysql databases


#1

Hi,

I’ve got an app that talks to two databases on a given MySQL server.
When I run in development mode, pointing to the MySQL server running
on localhost (127.0.0.1),
I am able to access both databases without any problem. The relevant
yaml looks like this:
(names have been changed to protect the innocent)

development:
adapter: mysql
database: dev
username: username
password: password
hostname: 127.0.0.1

dev2:
adapter: mysql
database: dev2
username: username
password: password
hostname: 127.0.0.1

When I change the environment to “production”, I am unable to access
the database that is not named “production”. I get an error that
reads “Mysql::Error: Unknown database ‘prod2’”. The production part
of the yaml looks like:

production:
adapter: mysql
database: prod
username: username
password: password
hostname: db.prod.mycompany.com

prod2:
adapter: mysql
database: prod2
username: username
password: password
hostname: db.prod.mycompany.com

When I change the “development” and “dev2” to point to the production
server and tables, I get the same error.

This leads me to believe that the dev and prod mysql servers are
configured differently, but I wanted to double check and see if anyone
has seen this problem before (and that it might be rails).

Anyone?

Thanks,
-kevin