6

I'm currently stuck on what is (I hope a newby) problem with a rails project (this is my first rails project and so I apologise if I miss anything crucial). I've been at this for a couple of hours and can't seem to find any solutions. I have tried the solutions to the following threads with no avail.

connect to local MySQL server through socket

Can't connect to local MySQL server through socket

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Can't connect to local MySQL server through socket '/tmp/mysql.sock'

The list goes on, anyway some of the threads are similar to my situation others are just clutching at straws. Let me give you a quick overview of my situation.

  • The project has been developed on a mac
    • I have recently set up a test server as a means of learning the deployment process
    • The server is running Ubuntu Server 12.04

I managed to follow some tutorials to set it up including the Capistrano deployment tutorial up to the point of:

$ rake RAILS_ENV=production db:schema:load

which was where I first encountered the Can't connect to local MySQL server error.

if I run it with --trace I get the following output:

** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:277:in `new_connection'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:287:in `checkout_new_connection'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:235:in `block (2 levels) in checkout'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `loop'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `block in checkout'
/usr/share/ruby-rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `checkout'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_connection'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/model_schema.rb:308:in `clear_cache!'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/railtie.rb:91:in `block (2 levels) in <class:Railtie>'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:418:in `_run__427268845__prepare__407057367__callbacks'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/actionpack-3.2.2/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/actionpack-3.2.2/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/initializable.rb:30:in `instance_exec'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/initializable.rb:30:in `run'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/initializable.rb:54:in `each'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/initializable.rb:54:in `run_initializers'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/application.rb:136:in `initialize!'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/little_oven_deploy/releases/20120705162026/config/environment.rb:5:in `<top (required)>'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/application.rb:103:in `require_environment!'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/application.rb:292:in `block (2 levels) in initialize_tasks'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/share/ruby-rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/share/ruby-rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/bin/rake:19:in `load'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@global/bin/rake:19:in `<main>'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/bin/ruby_noexec_wrapper:14:in `eval'
/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:schema:load => environment

my database.yml file is as follows:

# 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
development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: little_oven_devel
  pool: 5
  username: devel
  password: Development1
  socket: /var/run/mysqld/mysql.sock

# 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:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: little_oven_test
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: little_oven_production
  pool: 5
  username: production
  password: Production1
  socket: /var/run/mysqld/mysql.sock

Note that I have changed the location of the socket variable to correspond with what I believe is the .sock file on ubuntu as this differs from a standard install on mac OSX.

finally, I also get the same error when running

rails c

with the following output:

/usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2) (Mysql2::Error)
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:277:in `new_connection'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:287:in `checkout_new_connection'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:235:in `block (2 levels) in checkout'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `loop'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `block in checkout'
    from /usr/share/ruby-rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `checkout'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_connection'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/model_schema.rb:308:in `clear_cache!'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activerecord-3.2.2/lib/active_record/railtie.rb:91:in `block (2 levels) in <class:Railtie>'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:418:in `_run__485859349__prepare__1069885904__callbacks'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/actionpack-3.2.2/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/actionpack-3.2.2/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/initializable.rb:30:in `instance_exec'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/initializable.rb:30:in `run'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/initializable.rb:54:in `each'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/initializable.rb:54:in `run_initializers'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/application.rb:136:in `initialize!'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /var/www/little_oven_deploy/releases/20120705162026/config/environment.rb:5:in `<top (required)>'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/application.rb:103:in `require_environment!'
    from /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/railties-3.2.2/lib/rails/commands.rb:40:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

I would like to point out that the location /usr/share/ruby-rvm/gems/ruby-1.9.2-p318@rails_3_2/gems/mysql2-0.3.11/lib/mysql2/client.rb is valid. Also, mysql is running and I can access it with:

mysql -u production -p
Community
  • 1
  • 1
DazBaldwin
  • 4,125
  • 3
  • 39
  • 43
  • When you run "locate mysql.sock" on the Ubuntu server, does it return "/var/run/mysqld/mysql.sock"? Also, are you sure Rails is loading that database.yml file? – sigre Jul 05 '12 at 20:21
  • @Ryan, actually I did try locate mysql.sock but it returns nothing, that's why I hooked it up to the mysqld.sock, this was however merely an (un)educated guess. in terms of establishing the loading of the yml file, how would I find that out? – DazBaldwin Jul 05 '12 at 22:31

4 Answers4

11

You can alternatively remove the socket specification from the production environment in database.yml

production:
  # socket: /var/run/mysqld/mysql.sock

I understand performance is reduced slightly, but it got me through a similar problem.

Josh W Lewis
  • 1,319
  • 11
  • 19
  • This has worked, After commenting out your suggestion, I could run the rake command, `$ rake RAILS_ENV=production db:schema:load` but `rails c` was still throwing the same error. I have now commented the same `socket:` specification in the development section as well and the console is now working correctly. could you explain why this works? are there any other pitfalls involved with this tactic, performance issues aside? – DazBaldwin Jul 06 '12 at 10:55
  • As I understand, you can connect to MySQL through a Unix socket when the database and the application are on the same server. This is generally faster than connecting over TCP. However, larger scale apps usually have the database on a different server, in that case TCP is used. My point being, that it's most likely not noticeable. – Josh W Lewis Jul 06 '12 at 14:07
  • 1
    @Promethean_Sin `rails c` runs console in development mode. Use `rails c production` to run it in production mode. That is why your console (in dev mode) started working after uncommenting also in development section. – Jakub Naliwajek Jul 06 '12 at 15:34
3

/tmp/mysqld.sock is the location of the socket for OSX.

On linux Mint/Ubuntu, it should be at /var/run/mysqld/mysql.sock.

If it's not, then the location should be referenced in one of the MySQL config files, named my.cnf. The location and load order of these files will print out if you enter

mysql --help

into a terminal. If you can't find the my.cnf file at the specified path, it doesn't exist, so ignore it, and look to the next one in the load order.

^ That is the simple, surefire way to verify your socks configuration.

Josh Lewis's answer should be valid, as my Rails 4.0.3 install defaults to omitting the socket line - so I'm assuming it's predefined or auto-configured by the installation, and it's not something you should have to worry about.

Not to revive an old question, but it comes up as a top listing on Google search.

0

Some random ideas:

  • Who is the owner of /var/run/mysqld/mysql.sock? I know it's in a first link you mentioned, but maybe you missed it. Is it accessible for user from whom you run commands?

  • Maybe default MySQL port (3306) is blocked? I suppose it may prevent Rails, even when you're running things locally since in Unix design ports are everywhere. If you're running on Amazon, notice that they keep all ports closed by default (as well as dropping all PING requests by default, but that's another issue) and you may have to click through options in their dashboard

  • try to add host: 127.0.0.1 and port: 3306 to your production config settings

  • try to remove pool and reconnect options and see what happens (that's a totally wild guess)

  • there are some ideas over there, that in such case you should uninstall mysql-client and mysql-server packages and install them again, but I've not seen a point why is that

Jakub Naliwajek
  • 707
  • 5
  • 9
  • No, wait... Amazon blocking ports shouldn't be an issue, I suppose. But you may still check that, I don't have much experience with EC2 and have no idea how their custom firewalls are working, externally or internally. – Jakub Naliwajek Jul 05 '12 at 20:48
0

$ mysqld

f error "mysql-files" dir

$ sudo mkdir /var/lib/mysql-files

$ sudo chown -R mysql:mysql /var/lib/mysql-files/

$ sudo chmod 700 /var/lib/mysql-files/