다음 사이트를 참고하여 Ubuntu 18.04에서 MySQL 8.0을 설치하였다.

 

https://www.fosstechnix.com/how-to-install-mysql-8-in-ubuntu/

 

How to Install MySQL 8.0 on Ubuntu 18.04 / 16.04 - FOSS TechNix

In this article, We are going to demonstrate installation of latest MySQL 8.0 database server on Ubuntu 18.04 Bionic Beaver step by step using command line.

www.fosstechnix.com

 

MySQL 설치 순서는 다음과 같다.

 

1. MySQL APT Repository 추가

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

 

Repository 버전은 아래 MySQL 사이트 하단에 보이는 버전을 추가하였다.

 

https://dev.mysql.com/downloads/repo/apt/

 

 

2. MySQL APT Repository 패키지 다운로드

sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb

 

위의 명령어를 입력하면 아래와 같은 창이 뜨는데 OK를 선택하면 된다.

 

 

3. MySQL Repository 업데이트

sudo apt-get update

 

4. MySQL 8.0 Server 설치

sudo apt-get install mysql-server

 

위의 명령어를 입력하면 아래와 같이 창이 뜨는데 root 계정에서 사용할 비밀번호를 입력해주면 된다.

 

한 번 더 입력해준다.

그리고 아래와 같은 창이 뜰텐데 Use Strong Password Encrypthon을 선택한다.

 

 

5. mysql_secure_installation 설정

mysql_secure_installation

 

보안과 관련된 설정을 하기 위해 위의 명령어를 입력하면 방금 전에 설정한 root 계정의 비밀번호를 입력하라고 나온다. 

 

root 계정의 비밀번호를 입력하고 나면  아래와 같이 몇 가지 보안과 관련된 설정을 하게 되는데 상황에 맞게 설정하면 된다.

 

참고로 나는 아래와 같이 설정하였다.


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: N
Using existing password for root.
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) : N

 ... 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!

 

6. root 계정으로 MySQL에 로그인

mysql -u root -p

 

이로써 MySQL 설치가 완료되었다. 추가로 MySQL 서비스와 관련된 명령어는 아래와 같다.

 

MySQL 서비스 시작

sudo systemctl start mysql.service

MySQL 서비스 중지

sudo systemctl stop mysql.service

MySQL 서비스 재시작

sudo systemctl restart mysql.service

MySQL 서비스 상태 검사

sudo systemctl status mysql.service

 

+ Recent posts