2
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【MySQL】ERROR 2002の対処法

Posted at

##状況

私は研究でWebサーバーを構築し,その中にMySQLを入れているのですが,ある日突然mysqlを起動すると下記のエラーが出て起動しなくなりました.

error
# mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

その際、私が行った対処を下記に記す.

##対処法

###原因
原因は,mysql.sockが上記のエラーに書かれている場所にないことだと思うので,作ってやればいい.

##mysql.sockの作成

コマンド
# touch /var/lib/mysql/mysql.sock

これで,上記の場所にmysql.sockが作成されたので,再度MySQLを起動してみる.

コマンド
# /etc/rc.d/init.d/mysqld start

これで私は,MySQLを起動することができた.

2
5
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
2
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?