Gotta stop googling everytime this happens.
Mysql
Load mysql dump
$ mysqld_safe & # start mysql server
$ mysql -u root app_development < dump.sql # load dump
ERROR 2006 (HY000) at line 151988: MySQL server has gone away
oops looks like we got an error
Customize Mysql configuration
$ mysqladmin -u root shutdown # shutdown server for configuration change
$ mkdir -p /usr/local/mysql/etc # create configuration dir if doesn't exist
$ cp /usr/local/mysql/{support-files/my-large.cnf,etc/my.cnf} # copy template
Increase max allowed packet size
edit my.cnf
with $ $EDITOR /usr/local/mysql/etc/my.cnf
and locate section:
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
and increase max_allowed_packet
value, ie:
max_allowed_packet = 16M
Finally load dump
$ mysqld_safe & # start mysql again
$ mysql -u root app_development < dump.sql # should go without error
Great success!
Ruby and Mysql issues
Got an error
~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': dlopen(~/.rvm/gems/ruby-1.9.2-p290/bundler/gems/mysql2-d3a96b8e11e9/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: ~/.rvm/gems/ruby-1.9.2-p290/bundler/gems/mysql2-d3a96b8e11e9/lib/mysql2/mysql2.bundle
Reason: image not found - ~/.rvm/gems/ruby-1.9.2-p290/bundler/gems/mysql2-d3a96b8e11e9/lib/mysql2/mysql2.bundle
from ~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from ~/.rvm/gems/ruby-1.9.2-p290/bundler/gems/mysql2-d3a96b8e11e9/lib/mysql2.rb:9:in `<top (required)>'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:68:in `require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:66:in `each'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:66:in `block in require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:55:in `each'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler/runtime.rb:55:in `require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.1.rc/lib/bundler.rb:128:in `require'
from ~/src/app/config/application.rb:8:in `<top (required)>'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:38:in `require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:38:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
fix is pretty straightforward:
$ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/mysql/lib
append mysql/lib
to load path
more here