본문 바로가기

IT+프로그래밍 - 웹서버 구축

[mariaDB]WSL에서 mariaDB설치

WSL 윈도우 앱으로 리눅스 서버를 설치할 수 있다.
그 때 mariaDB를 설치하게 되면 2가지 정도 문제점이 생길 수 있다.
1. 설정차이로 인해서, 기존에 mariaDB가 설치되어야 하는 폴더에 시작에 필요한 mysql.init 파일이 설치되지 않는 경우
2. WSL을 사용하는 윈도우에 mysql이나 mariaDB가 설치되어 있거나, 3306 포트를 사용하고 있는 경우

저 2가지 문제로 4시간 정도의 시간이 순삭되었다.

1번 이슈의 경우, 3가지 액션을 하면 해결이 된다.
1. mysql/mariadb 실행에 필요한 파일이 있어야 될 자리에 파일을 복사한다.
2. 해당 폴더에 권한을 부여한다.
3. mysql 서버를 시작한다. (아래 3가지 액션을 하면된다.)

sudo cp /usr/share/mysql/mysql.init /etc/init.d/mysql
sudo chmod 755 /etc/init.d/mysql
sudo service mysql start

그리고 나서 제대로 서버가 가동되었는지는 service를 통해서 확인한다.

sudo service mysql status

MariaDB 설치는 위래 경로로 들어가면 된다.
https://downloads.mariadb.org/mariadb/repositories/#distro=Ubuntu&distro_release=bionic--ubuntu_bionic&mirror=fe_up_pt&version=10.4

 

MariaDB - Setting up MariaDB Repositories - MariaDB

To generate the entries select an item from each of the boxes below. Once an item is selected in each box, your customized repository configuration will appear below. 1. Choose a Distro SLES openSUSE Arch Linux Mageia Fedora CentOS RedHat Mint Ubuntu Debia

downloads.mariadb.org

2번 이슈는 하나의 컴퓨터에 2가지 운영체제를 운영하면서 발생하는 이슈로, 
포트설정의 문제였다. 설치를 하게 되면 mysql과 mariadb가 기본으로 3306포트를 사용하게 되는데,
나의 경우 윈도우에 mariaDB가 이미 이포트를 사용하고 있어서, WSL ubuntu가 해당 포트를 사용하지 못하게 되어
최초 설정이 진행되지 못했다. 

단초는 깃허브에서 발견했고, 

https://github.com/microsoft/WSL/issues/745#issuecomment-237412792

 

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

/etc/mysql/my.cnf 의 포트를 바꿈으로 해결했다. 

port 부분을 3308로 바꾸어서 해결!

하나하나 배워가는 것이 좋기도 하지만 녹아들어가는 시간이 만만치 않다 ㅠㅠ