1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ソケットファイルとは?

Posted at

'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)というエラーに遭遇した。

env:rails5 mysql5.7.32

As a supplement, I also encountered the problem 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)', but the reason for the error was caused by the socket files

database.yml

default: &default
socket: /tmp/mysql.sock
login mysql mysql -uroot -p then show variables like 'socket';

+---------------+-----------------------------+
| Variable_name | Value |
+---------------+-----------------------------+
| socket | /var/run/mysqld/mysqld.sock |
+---------------+-----------------------------+
so change database.yml

default: &default
socket: /var/run/mysqld/mysqld.sock # The line can also be deleted

ソケットファイルの変数をshow variables like 'socket'で調べて変更するといいらしい。
mysqladmin --socket=/path/to/socket versionで動作しているか確認できるらしいが
パスワードがなかったからアクセスできなかった。
また今度にしたい。

ソケットファイルとは?

サーバーがローカルクライアントと通信するために使用する UNIX ソケットファイル

UNIX の一部のバージョンでは、/tmp ディレクトリ内のファイル、または一時ファイルに使用されるほかの同様のディレクトリ内のファイルをだれでも削除できます。 ソケットファイルがシステム上のそのようなディレクトリに配置されている場合は、問題となることがあります。

socket:電球などの〕受け口、ソケット 出典 英辞郎

unixドメインソケットとは

UNIXドメインソケットです。このソケットは一つのマシン上のプロセスのみを通信させる方法です。

通常インターネットで利用しているソケット通信(INETドメインソケット通信)とは異なり、ネットワーク経由ではないローカルマシン上のプロセスが利用するソケットが、UNIXドメインソケットである。

感想

通信するために使うものなのか。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?