Closed vsreenath664 closed 6 years ago
Nevermind, as pasted above it was an issue with the db credentials, <%= ENV %>was not required along with the db credentials. I have removed the same and just provided the db name, username, password and host name only. Now it works! Closing this one, thanks!
I am trying to setup fluxday on a centOS 7 server by following the steps provided at https://github.com/foradian/fluxday/ . All the dependencies are installed and I also downgraded MariaDB to 10.1, in order to fix the error related to mysql2 gem as suggested here, https://github.com/brianmario/mysql2/issues/932 .
I already cloned Clone Fluxday from git and completed the first few steps including the 'bundle install'. Then I followed the "without docker" instructions and copied config/database.yml.example to config/database.yml . As outlined in the docs I have created the MySQL database and database user manually, then updated the database credentials in database.yml file with those values. I then executed "rake db:create" without any errors or outputs. But the next step "rake db:migrate" throws the following error,
rake db:migrate
rake aborted! ActiveRecord::StatementInvalid: Mysql2::Error: No database selected: SHOW TABLES LIKE 'schema_migrations' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/mysql2-0.3.21/lib/mysql2/client.rb:80:in
_query' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/mysql2-0.3.21/lib/mysql2/client.rb:80:in
block in query'I am not sure why it is showing the above error, as the database is already created and credentials are already added in database.yml file. I am enclosing the contents of my database.yml file below,
MySQL. Versions 4.1 and 5.0 are recommended.
#
Install the MYSQL driver
gem install mysql2
#
Ensure the MySQL gem is defined in your Gemfile
gem 'mysql2'
#
And be sure to use new-style password hashing:
http://dev.mysql.com/doc/refman/5.0/en/old-client.html
default: &default adapter: mysql2 encoding: utf8 pool: 5 database: <%= ENV['db_fluxday'] %> username: <%= ENV['user_fluxday'] %> password: <%= ENV['password'] %> host: <%= ENV['localhost'] %>
development: <<: *default
Warning: The database defined as "test" will be erased and
re-generated from your development database when you run "rake".
Do not set this db to the same as development or production.
test: database: flux-tests <<: *default
production: <<: *default
I am able to connect to the above database via MySQL command line without any issues, but it doesn't show any tables in it currently. Could you check and advice why it is throwing the above error when running rake db:migrate ?