Can't create db in non local mysql server
dexternica opened this issue · 2 comments
Hi.
I have CentOS 7, with Ruby 2.1.0 via rvm
My db server is MariaDB 5.5.56
When I execute rake db:migrate
I receive the following message:
rake aborted! Mysql2::Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/mysql2-0.3.21/lib/mysql2/client.rb:70:in 'connect' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/mysql2-0.3.21/lib/mysql2/client.rb:70:in 'initialize' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_adapters/mysql2_adapter.rb:18:in 'new' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_adapters/mysql2_adapter.rb:18:in 'mysql2_connection' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in 'new_connection' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in 'checkout_new_connection' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in 'acquire_connection' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in 'block in checkout' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in 'checkout' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in 'block in connection' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in 'connection' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in 'retrieve_connection' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_handling.rb:79:in 'retrieve_connection' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/connection_handling.rb:53:in 'connection' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/migration.rb:863:in 'initialize' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/migration.rb:764:in 'new' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/migration.rb:764:in 'up' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/migration.rb:742:in 'migrate' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/activerecord-4.0.3/lib/active_record/railties/databases.rake:42:in 'block (2 levels) in <top (required)>' /usr/local/rvm/gems/ruby-2.1.0@fluxday/gems/rake-12.2.1/exe/rake:27:in '<top (required)>' /usr/local/rvm/gems/ruby-2.1.0@fluxday/bin/ruby_executable_hooks:15:in 'eval' /usr/local/rvm/gems/ruby-2.1.0@fluxday/bin/ruby_executable_hooks:15:in '<main>' Tasks: TOP => db:migrate (See full trace by running task with --trace)
It's because the db is in another server?
Cheers.
Make sure that db is configured properly in database.yml
I am getting the same thing. Could it be that I am using Amazon RDS with MySQL 5.6? I've doublechecked my connection string and credentials.