エラー内容
h2tomo:potepanec meotomohiro$ bundle exec rails s -p 3001 WARNING: Nokogiri was built against LibXML version 2.9.7, but has dynamically loaded 2.9.4 => Booting Puma => Rails 5.1.4 application starting in development => Run `rails server -h` for more startup options Exiting /Users/tomohiro/work/ec/vendor/bundle/ruby/2.4.0/gems/mysql2-0.4.9/lib/mysql2/client.rb:89:in `connect': Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38) (Mysql2::Error) from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/mysql2-0.4.9/lib/mysql2/client.rb:89:in `initialize' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/mysql2_adapter.rb:21:in `new' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/mysql2_adapter.rb:21:in `mysql2_connection' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/model_schema.rb:331:in `table_exists?' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/solidus_core-2.3.0/app/models/spree/preferences/store.rb:82:in `should_persist?' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/solidus_core-2.3.0/app/models/spree/preferences/store.rb:31:in `get' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/solidus_core-2.3.0/app/models/spree/preferences/scoped_store.rb:13:in `fetch' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/solidus_core-2.3.0/app/models/spree/preferences/preferable_class_methods.rb:26:in `block in preference' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/solidus_auth_devise-1.6.4/config/routes.rb:4:in `block in <top (required)>' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/mapper.rb:629:in `instance_exec' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/mapper.rb:629:in `block in with_default_scope' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/mapper.rb:866:in `scope' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/mapper.rb:628:in `with_default_scope' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:424:in `eval_block' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:408:in `draw' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/solidus_auth_devise-1.6.4/config/routes.rb:1:in `<top (required)>' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:55:in `block in load_paths' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:55:in `each' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:55:in `load_paths' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:18:in `reload!' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:41:in `block in updater' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/file_update_checker.rb:81:in `execute' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:42:in `updater' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:31:in `execute_if_updated' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:128:in `block in <module:Finisher>' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers' from /Users/meotomohiro/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each' from /Users/meotomohiro/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' from /Users/meotomohiro/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from' from /Users/meotomohiro/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component' from /Users/meotomohiro/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:347:in `each' from /Users/meotomohiro/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:347:in `call' from /Users/meotomohiro/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component' from /Users/meotomohiro/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each' from /Users/meotomohiro/.rbenv/versions/2.4.1/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!' from /Users/meotomohiro/work/potepanec/config/environment.rb:5:in `<top (required)>' from config.ru:3:in `require_relative' from config.ru:3:in `block in <main>' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize' from config.ru:in `new' from config.ru:in `<main>' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:24:in `app' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:80:in `log_to_stdout' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:42:in `start' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:135:in `block in perform' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke' from /Users/meotomohiro/work/potepanec/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>'
h2tomo:potepanec meotomohiro$ sudo mysql.server restart ERROR! MySQL server PID file could not be found! Starting MySQL .. ERROR! The server quit without updating PID file (/usr/local/var/mysql/h2tomo.pid).
解決策
起動していたmysqlのプロセスを削除する
h2tomo:var tomohiro$ ps ax | grep mysql 534 ?? S 0:00.06 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --bind-address=127.0.0.1 --datadir=/usr/local/var/mysql 689 ?? S 1:11.38 /usr/local/Cellar/mysql/5.7.17/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.7.17 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.7.17/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/h2tomo.local.err --pid-file=/usr/local/var/mysql/h2tomo.local.pid 89650 ?? S 0:00.04 /bin/sh /usr/local/opt/mysql@5.7/bin/mysqld_safe --datadir=/usr/local/var/mysql 89737 ?? S 0:00.29 /usr/local/opt/mysql@5.7/bin/mysqld --basedir=/usr/local/opt/mysql@5.7 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/mysql@5.7/lib/plugin --log-error=h2tomo.err --pid-file=h2tomo.pid 89750 s001 S+ 0:00.00 grep mysql h2tomo:var meotomohiro$ kill -9 534 h2tomo:var meotomohiro$ kill -9 689 -bash: kill: (689) - No such process h2tomo:var meotomohiro$ kill -9 89650 -bash: kill: (89650) - No such process h2tomo:var meotomohiro$ kill -9 89737 -bash: kill: (89737) - No such process h2tomo:var meotomohiro$ ps ax | grep mysql 89768 ?? S 0:00.04 /bin/sh /usr/local/opt/mysql@5.7/bin/mysqld_safe --datadir=/usr/local/var/mysql 89855 ?? S 0:00.31 /usr/local/opt/mysql@5.7/bin/mysqld --basedir=/usr/local/opt/mysql@5.7 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/mysql@5.7/lib/plugin --log-error=h2tomo.err --pid-file=h2tomo.pid 89861 ?? S 0:00.04 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --bind-address=127.0.0.1 --datadir=/usr/local/var/mysql 89969 ?? S 0:00.62 /usr/local/Cellar/mysql/5.7.17/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.7.17 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.7.17/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/h2tomo.err --pid-file=/usr/local/var/mysql/h2tomo.pid 89974 s001 S+ 0:00.00 grep mysql h2tomo:var meotomohiro$ kill -9 89768 h2tomo:var meotomohiro$ ps ax | grep mysql 89855 ?? S 0:00.31 /usr/local/opt/mysql@5.7/bin/mysqld --basedir=/usr/local/opt/mysql@5.7 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/opt/mysql@5.7/lib/plugin --log-error=h2tomo.err --pid-file=h2tomo.pid 89861 ?? S 0:00.04 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --bind-address=127.0.0.1 --datadir=/usr/local/var/mysql 89969 ?? S 0:00.62 /usr/local/Cellar/mysql/5.7.17/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.7.17 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.7.17/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/h2tomo.err --pid-file=/usr/local/var/mysql/h2tomo.pid 90047 s001 S+ 0:00.00 grep mysql h2tomo:var meotomohiro$ kill -9 89855 h2tomo:var meotomohiro$ ps ax | grep mysql 89861 ?? S 0:00.04 /bin/sh /usr/local/opt/mysql/bin/mysqld_safe --bind-address=127.0.0.1 --datadir=/usr/local/var/mysql 89969 ?? S 0:00.63 /usr/local/Cellar/mysql/5.7.17/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.7.17 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.7.17/lib/plugin --bind-address=127.0.0.1 --log-error=/usr/local/var/mysql/h2tomo.err --pid-file=/usr/local/var/mysql/h2tomo.pid 90120 s001 R+ 0:00.00 grep mysql h2tomo:var meotomohiro$ kill -9 89861 h2tomo:var meotomohiro$ ps ax | grep mysql 90282 s001 S+ 0:00.00 grep mysql h2tomo:var meotomohiro$ ps ax | grep mysql 90284 s001 S+ 0:00.00 grep mysql h2tomo:var meotomohiro$ cd h2tomo:~ meotomohiro$ cd work/potepanec/ h2tomo:potepanec meotomohiro$ sudo mysql.server start Starting MySQL SUCCESS! h2tomo:potepanec meotomohiro$ usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]] [-e pattern] [-f file] [--binary-files=value] [--color=when] [--context[=num]] [--directories=action] [--label] [--line-buffered] [--null] [pattern] [file ...] 2018-07-21T05:03:36.6NZ mysqld_safe A mysqld process already exists
参考にしたサイト
https://qiita.com/YamKenta/items/a33499a7db7946a43381
https://qiita.com/mogetarou/items/e34ca51d3756d55d7800