数日前までdockerでの開発ができていたのですが、ローカルでmysqlのエラーが出たため、色々といじっていたら今度は同じくMySQLのエラーでdockerでの開発できなくなってしまいました。。
エラーの内容は以下記載しますが、MySQLへの接続ができないようです。
これまでやってみた内容も記載しますので、どなたかアドバイスをいただけると幸いです。
(base) $ docker-compose run web rails db:create Starting testapp_db_1 ... done Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory") Couldn't create 'app_name_development' database. Please check your configuration. rails aborted! Mysql2::Error::ConnectionError: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory") 〜以下省略
以下、これまで行った内容
(base) $ cd ~/./var/run/mysqld -bash: cd: /./var/run/mysqld: No such file or directory (base) $ mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.6.47 Homebrew Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> exit Bye (base) $ sudo /etc/init.d/mysqld restart Password: sudo: /etc/init.d/mysqld: command not found (base) $ mysql.server restart Shutting down MySQL .... SUCCESS! Starting MySQL .. SUCCESS! (base) $ sudo rm -f /var/run/mysqld/mysqld.sock (base) $ sudo rm -f /tmp/mysql.sock (base) $ sudo /etc/init.d/mysql start sudo: /etc/init.d/mysql: command not found (base) $ mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (base) $ sudo mysql.server start --log Starting MySQL SUCCESS! (base) $ 200116 23:04:35 mysqld_safe A mysqld process already exists (base) $ cd /etc/myslq -bash: cd: /etc/myslq: No such file or directory (base) $ cd /etc (base) $ ls afpovertcp.cfg localtime php.ini.default aliases locate.rc postfix aliases.db mach_init.d ppp apache2 mach_init_per_login_session.d profile asl mach_init_per_user.d protocols asl.conf mail.rc racoon auto_home man.conf rc.common auto_master manpaths rc.netboot autofs.conf manpaths.d resolv.conf bashrc master.passwd rmtab bashrc_Apple_Terminal nanorc rpc com.apple.screensharing.agent.launchd networks rtadvd.conf csh.cshrc newsyslog.conf security csh.login newsyslog.d services csh.logout nfs.conf shells cups notify.conf snmp defaults ntp.conf ssh dnsextd.conf ntp_opendirectory.conf ssl emond.d openldap sudo_lecture find.codes pam.d sudoers fstab.hd passwd sudoers.d ftpusers paths syslog.conf gettytab paths.d ttys group periodic wfs hosts pf.anchors xtab hosts.equiv pf.conf zprofile irbrc pf.os zshrc kern_loader.conf php-fpm.conf.default krb5.keytab php-fpm.d (base) $ mysqld --version mysqld Ver 5.6.47 for osx10.14 on x86_64 (Homebrew) (base) $ mysql_config --socket /tmp/mysql.sock (base) $ mysql --help | grep my.cnf order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf (base) cd /usr/local/etc/my.cnf -bash: cd: /usr/local/etc/my.cnf: Not a directory (base) $ cd ~./usr/local/etc/my.cnf -bash: cd: ~./usr/local/etc/my.cnf: No such file or directory (base) $ sudo /etc/init.d/mysql start Password: sudo: /etc/init.d/mysql: command not found
あなたの回答
tips
プレビュー