作成しているアプリのディレクトリ内での、mysqlにログインできません。
rails db:create Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) Couldn't create 'アプリ名_development' database. Please check your configuration. rails aborted! Mysql2::Error::ConnectionError: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) /Library/Ruby/Gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect' /Library/Ruby/Gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `initialize' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:24:in `new' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/mysql2_adapter.rb:24:in `mysql2_connection' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_handling.rb:221:in `retrieve_connection' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/connection_handling.rb:189:in `connection' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/mysql_database_tasks.rb:8:in `connection' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/mysql_database_tasks.rb:16:in `create' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/database_tasks.rb:126:in `create' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/database_tasks.rb:185:in `block in create_current' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/database_tasks.rb:479:in `block (2 levels) in each_current_configuration' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/database_tasks.rb:476:in `each' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/database_tasks.rb:476:in `block in each_current_configuration' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/database_tasks.rb:475:in `each' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/database_tasks.rb:475:in `each_current_configuration' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/tasks/database_tasks.rb:184:in `create_current' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/railties/databases.rake:39:in `block (2 levels) in <main>' /Library/Ruby/Gems/2.6.0/gems/railties-6.0.3.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform' /Library/Ruby/Gems/2.6.0/gems/railties-6.0.3.1/lib/rails/commands/rake/rake_command.rb:20:in `perform' /Library/Ruby/Gems/2.6.0/gems/railties-6.0.3.1/lib/rails/command.rb:48:in `invoke' /Library/Ruby/Gems/2.6.0/gems/railties-6.0.3.1/lib/rails/commands.rb:18:in `<main>' /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' /Library/Ruby/Gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:324:in `block in require' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:291:in `load_dependency' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/dependencies.rb:324:in `require' /Users/apple/create/portfolio/bin/rails:9:in `<top (required)>' /Library/Ruby/Gems/2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load' /Library/Ruby/Gems/2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call' /Library/Ruby/Gems/2.6.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call' /Library/Ruby/Gems/2.6.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run' /Library/Ruby/Gems/2.6.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>' /Library/Ruby/Gems/2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load' /Library/Ruby/Gems/2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>' /Users/apple/create/portfolio/bin/spring:15:in `<top (required)>' bin/rails:3:in `load' bin/rails:3:in `<main>' Tasks: TOP => db:create
仮説
ソケットファイルが存在していないか、mysqlのアクセス権限が拒否されているためにこのようなエラーがおこっている可能性がある。
reコマンドを利用し、ソケットファイルの削除を行い、touchコマンドでソケットファイルを作成しました。しかし、解決に至らずエラー文も一緒のまま、、、
mysql -r -pコマンドを実行し、mysqlへのログインを試みると、、
mysql -r -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
6/26日(金)追記します!
とても親切に助言をいただきました!ありがとうございます。
masibwさんに、エラーログの表示のアドバイスをいただいたので、表示します。6/21日からのエラーログになります。
Version: '5.6.47' socket: '/tmp/mysql.sock' port: 3306 Homebrew 2020-06-21 22:33:39 930 [Note] /usr/local/opt/mysql@5.6/bin/mysqld: Normal shutdown 2020-06-21 22:33:39 930 [Note] Giving 2 client threads a chance to die gracefully 2020-06-21 22:33:39 930 [Note] Event Scheduler: Purging the queue. 0 events 2020-06-21 22:33:39 930 [Note] Shutting down slave threads 2020-06-21 22:33:41 930 [Note] Forcefully disconnecting 2 remaining clients 2020-06-21 22:33:41 930 [Warning] /usr/local/opt/mysql@5.6/bin/mysqld: Forcing close of thread 101 user: 'suirunakamura' 2020-06-21 22:33:41 930 [Warning] /usr/local/opt/mysql@5.6/bin/mysqld: Forcing close of thread 100 user: 'suirunakamura' 2020-06-21 22:33:41 930 [Note] Binlog end 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'partition' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_SYS_FIELDS' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_SYS_INDEXES' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_SYS_TABLES' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_FT_CONFIG' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_FT_DELETED' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_METRICS' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_CMPMEM' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_CMP_RESET' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_CMP' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_LOCK_WAITS' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_LOCKS' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'INNODB_TRX' 2020-06-21 22:33:41 930 [Note] Shutting down plugin 'InnoDB' 2020-06-21 22:33:41 930 [Note] InnoDB: FTS optimize thread exiting. 2020-06-21 22:33:41 930 [Note] InnoDB: Starting shutdown... 2020-06-21 22:33:43 930 [Note] InnoDB: Shutdown completed; log sequence number 7505335 2020-06-21 22:33:43 930 [Note] Shutting down plugin 'BLACKHOLE' 2020-06-21 22:33:43 930 [Note] Shutting down plugin 'ARCHIVE' 2020-06-21 22:33:43 930 [Note] Shutting down plugin 'MRG_MYISAM' 2020-06-21 22:33:43 930 [Note] Shutting down plugin 'MyISAM' 2020-06-21 22:33:43 930 [Note] Shutting down plugin 'MEMORY' 2020-06-21 22:33:43 930 [Note] Shutting down plugin 'CSV' 2020-06-21 22:33:43 930 [Note] Shutting down plugin 'sha256_password' 2020-06-21 22:33:43 930 [Note] Shutting down plugin 'mysql_old_password' 2020-06-21 22:33:43 930 [Note] Shutting down plugin 'mysql_native_password' 2020-06-21 22:33:43 930 [Note] Shutting down plugin 'binlog' 2020-06-21 22:33:43 930 [Note] /usr/local/opt/mysql@5.6/bin/mysqld: Shutdown complete
よろしくお願いします、、
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/06/21 13:44
2020/06/21 13:49
2020/06/21 14:55
2020/06/23 10:37
2020/06/23 11:44 編集
2020/06/23 12:18
2020/06/23 12:32 編集
2020/06/23 12:37
2020/06/23 12:38
2020/06/23 12:40
2020/06/23 12:45
2020/06/23 12:50
2020/06/23 12:59 編集
2020/06/23 13:00
2020/06/23 13:17 編集
2020/06/24 03:47
2020/06/24 08:15 編集
2020/06/24 08:26
2020/06/24 09:30 編集
2020/06/24 14:59
2020/06/25 12:14 編集
2020/06/25 15:01
2020/06/26 09:43
2020/06/26 09:44
2020/06/26 09:57
2020/06/26 09:59
2020/06/26 10:09
2020/06/26 10:11
2020/06/26 10:22 編集
2020/06/26 10:24
2020/06/26 10:31
2020/06/26 10:37
2020/06/26 10:38
2020/06/26 10:47
2020/06/26 11:01
2020/06/26 11:41 編集
2020/06/26 11:41
2020/06/26 11:51
2020/06/26 11:56 編集
2020/06/26 12:04
2020/06/26 12:10
2020/06/26 12:13
2020/06/26 12:14
2020/06/26 12:14
2020/06/26 12:37 編集
2020/06/26 12:35
2020/06/26 12:40 編集
2020/06/26 12:50
2020/06/26 15:19
2020/06/26 15:20
2020/06/26 16:01 編集
2020/06/26 16:01
2020/06/26 16:09
2020/06/26 16:15
2020/06/26 18:06 編集
2020/06/27 00:38
2020/06/29 06:47
2020/06/29 07:02
2020/06/29 07:18
2020/06/29 07:56
2020/06/29 07:59
2020/06/29 08:03
2020/06/29 13:16
2020/06/29 22:17
2020/06/29 23:55
2020/06/30 01:58
2020/06/30 02:33
2020/06/30 02:37
2020/06/30 02:44 編集
2020/06/30 02:49
2020/06/30 03:00
2020/06/30 06:45
2020/06/30 07:02
2020/06/30 07:04
2020/06/30 07:10
2020/06/30 07:11
2020/06/30 07:13
2020/06/30 07:14
2020/06/30 07:15
2020/06/30 07:16
2020/06/30 07:16
2020/06/30 07:17
2020/06/30 07:23 編集
2020/06/30 07:27
2020/06/30 07:28
2020/06/30 07:30
2020/06/30 07:31
2020/06/30 07:37
2020/06/30 07:37
2020/06/30 07:45
2020/06/30 07:48
2020/06/30 09:10 編集
2020/06/30 09:42
2020/06/30 10:32
2020/06/30 10:47
2020/06/30 10:49
2020/06/30 11:01 編集
2020/06/30 11:24
2020/07/01 06:37
2020/07/01 06:38
2020/07/01 07:45 編集
2020/07/02 00:03