Computer Science/Database

[에러] ERROR 2002 (HY000): Can't connect to local MySQL server through socket ''/var/run/mysqld/mysqld.sock' (2) 에러 해결

토마토. 2022. 8. 23. 20:17

에러 내용

$ mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '
'/var/run/mysqld/mysqld.sock' (2)

해결 방법

$ sudo apt install mysql-server
$ sudo mysql

 

참고로

$ service mysql
Usage: /etc/init.d/mysql start|stop|restart|reload|force-reload|status

여기서 시키는 대로 /etc/ 어쩌구로 실행했더니 authentication 문제가 발생해서

그냥 sudo mysql로 실행하는 게 편한 것 같다. 

 

$ sudo mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.30-0ubuntu0.20.04.2 (Ubuntu)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

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>