find rails database
Open a terminal window.
Navigate to your Rails application's root directory using the 'cd' command.
Access the Rails console by running the 'rails console' command.
To find the database configuration, use the following command:
ruby Rails.application.config.database_configuration
The output will be a hash containing database configuration details such as adapter, database name, username, and password.
To specifically access the database connection configuration for the current environment (e.g., development, test, production), use:
ruby Rails.application.config.database_configuration[Rails.env]
View the database connection details, including adapter, database name, username, and password, in the hash returned by the command.
To retrieve the active connection pool for the current environment, use:
ruby ActiveRecord::Base.connection_pool.db_config.configuration
Examine the hash output for connection pool details, including the adapter, database name, username, and password.
Exit the Rails console when done by typing 'exit' or pressing Ctrl + D.
Close the terminal window.