윈도우 wsl 우분투 20.04LTS 에서 장고 프레임워크를 사용하기 위해 mysql을 연결하는 작업중이었는데.
mysql 연동후 서버를 실행하니
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
알고보니, 해당 오류는 wsl환경에서 mysql이 자동 시작되지 않아서 생기는 문제였다.
https://github.com/microsoft/WSL/issues/745
ERROR 2002 (HY000): Can't connect to local MySQL server through socket... · Issue #745 · microsoft/WSL
Hello! I'm trying to install MySQL on Bash on Ubuntu on Windows. I'm running bash as admin and run sudo apt-get install mysql-server. In the middle of the installation I can find this: init...
github.com
myspl github에서 해당 에러를 겪고있는 사람들을 찾을 수 있었다.
sudo /etc/init.d/mysql start
서버를 시작하기 전, 해당 코드를 입력해서 문제를 해결 할 수 있었다.
다만 매번 가상환경을 적용하여 서버를 실행할 때 마다 해당 코드를 적용해야 하는 문제가 있었다.
해당 문제를 해결 할 수 있는 방법을 찾게되면 공유하겠다.
https://gowoonsori.com/settings/wsl2-mysql/
[SPSP] Bellman Ford
단일 최단경로를 구하는 알고리즘인 Bellman Ford알고리즘에 대해 정리하고 직접 구현해보는 글
gowoonsori.com
해당 블로그에서 자동실행으로 문제를 해결할 수 있었다.