# ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

**URL:** <https://forums.percona.com/t/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-lib-mysql-mysql-sock-111/27523>\
**Category:** MySQL & MariaDB\
**Created:** [January 2, 2024, 11:38am UTC](https://forums.percona.com/t/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-lib-mysql-mysql-sock-111/27523 "2024-01-02T11:38:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![parttime](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@parttime](https://forums.percona.com/u/parttime)\
**Post date:** [January 2, 2024, 11:38am UTC](https://forums.percona.com/t/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-lib-mysql-mysql-sock-111/27523/1 "2024-01-02T11:38:09Z")

</div>

Hi all,  
I am get this error. " ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (111) ".  
How can ı solve this error?

Thanks.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [January 2, 2024, 2:31pm UTC](https://forums.percona.com/t/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-lib-mysql-mysql-sock-111/27523/2 "2024-01-02T14:31:58Z")

</div>

@parttime, please check that MySQL is actually running. If MySQL is not running, restart it. If MySQL is running, then your tool is trying to connect to MySQL via socket that does not exist in that path. Log into MySQL via TCP/IP (ex: `mysql -h 127.0.0.1`) and check the location of the socket.

---

<div class="post-metadata">

**Author:** ![parttime](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@parttime](https://forums.percona.com/u/parttime)\
**Post date:** [January 4, 2024, 5:53am UTC](https://forums.percona.com/t/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-lib-mysql-mysql-sock-111/27523/3 "2024-01-04T05:53:18Z")

</div>

Mysql is not restart. How can ı this status?

---

<div class="post-metadata">

**Author:** ![eenos](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/eenos/32/14483_2.png) [@eenos](https://forums.percona.com/u/eenos)\
**Post date:** [January 4, 2024, 7:47am UTC](https://forums.percona.com/t/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-lib-mysql-mysql-sock-111/27523/4 "2024-01-04T07:47:05Z")

</div>

Try,

```auto
systemctl restart mysql 
tail -50 /var/log/mysqld.log

```

What os and what version of mysql ?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [January 4, 2024, 2:50pm UTC](https://forums.percona.com/t/error-2002-hy000-cant-connect-to-local-mysql-server-through-socket-var-lib-mysql-mysql-sock-111/27523/5 "2024-01-04T14:50:24Z")

</div>

@parttime,  
Use systemd to restart MySQL `sudo systemctl restart mysql`
