Ruby on Rails application could not be started

There appears to be a database problem.
  • Your config/database.yml may not be written correctly. Please check it and fix any errors.
  • Your database schema may be out of date or nonexistant. Please run rake db:migrate to ensure that the database schema is up-to-date.
  • The database server may not be running. Please check whether it's running, and start it if it isn't.
Error message:
Cannot connect to database localhost:12345: connection refused (1234)
Exception class:
Mysql::Error
Application root:
/foo/bar
Backtrace:
# File Line Location
0 ./render_error_pages.rb 25 in `create_database_exception'
1 ./render_error_pages.rb 76 in `start'
2 ./render_error_pages.rb 89