나만의 개발서버를 만들어보자 - MySQL 8.0 설치

이신필·2021년 9월 26일
0

MySQL 8.0버전을 우분투 18.04버전에서 설치하려면 패키지를 직접 받아와야하는 것 같다.
18.04버전에서는 mysql 5 버전대가 세팅되어있기 때문...
20.04 버전에서는 이미 8.0으로 세팅되어 있는듯 하다.

MySQL 버전 확인

아래 사이트에 버전을 기준으로 설치를 진행하였다.
https://dev.mysql.com/downloads/repo/apt/

패키지 받아오기

sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.19-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.19-1_all.deb

본격적인 설치

정상적으로 진행되었다면 다음과 같은 화면을 볼 수 있다.
별도로 바꿀 설정이 없으므로 ok

apt 업데이트를 진행하고

sudo apt-get update

아래명령어로 설치를 시작한다.

sudo apt-get install mysql-server

설치가 완료되면 root 비밀번호를 설정하는 화면이 뜬다. 적당한 비밀번호를 넣어주자

보안설정

보안설정을 해서 설치를 마무리 해보자

mysql_secure_installation

다음과같이 설정하였다... 기호에 맞게 설정하자

Securing the MySQL server deployment.

Enter password for user root:

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Using existing password for root.

Estimated strength of the password: 25
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : no

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

워크밴치 연결

MySQL 설치 및 세팅이 완료되었으니 로컬에서 워크밴치를 SSH 터널링을 이용해 접속해보자
3306포트로 직접 DB를 연결하려면 별도의 세팅이 필요하다.
필자는 개발용서버에서 DB를 로컬로만 이용할 예정이니 나중에 필요하면 설정할 예정,
해당 인스턴스를 db서버로 활용하는 것이 아니라면 개발용으로는 SSH 터널링을 이용해서 접근하는 것이 좋아보인다.
(굳이 3306포트를 개방할 필요가 없음)

먼저 워크벤치에서 커넥션 추가 버튼을 누른다.

커넥션 메소드를 SSH방식으로 변경한다.

Hostname에는 {해당 ip주소}:22를 입력
SSH Username에는 사용중인 서버의 유저네임 ex)ubuntu
연결방식을 비밀번호로 연결한다면 비밀번호를 넣으시고, pem파일로 연결한다면 key file을 등록
아래의 Username에는 root와 root 비밀번호를 store in Vault 버튼으로 입력해주자

test connection 버튼을 눌렀을 때 다음과 같이 나온다면 정상적으로 연결된다는 뜻

연결완료

제가 보려고 작성한 글이라 많이 부족합니다 좋은 피드백 부탁드립니다.
감사합니다

0개의 댓글