Ubuntu 패키지 정보 업데이트
1 2
| sudo apt update sudo apt upgrade
|
MySQL 설치
1
| sudo apt install -y mysql-server
|
MySQL 기본 세팅
1 2 3
| sudo ufw allow mysql # 외부 접속 기능 설정 (포트 3306 오픈) sudo systemctl start mysql # Mysql 실행 sudo systemctl enable mysql # Ubuntu 서버 재시작시 Mysql 자동 재시작
|
MySQL 외부접속 설정
1
| sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
|
bind-address를 127.0.0.1 -> 0.0.0.0 으로 변경

MySQL 언어셋 한글 설정
1
| sudo vi /etc/mysql/my.cnf
|
맨 밑에 다음 코드 첨부
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| [client] default-character-set = utf8
[mysqld] init_connect = SET collation_connection = utf8_general_ci init_connect = SET NAMES utf8 character-set-server = utf8 collation-server = utf8_general_ci
[mysqldump] default-character-set = utf8
[mysql] default-character-set = utf8
|
1 2 3
| sudo systemctl restart mysql # Mysql 재실행 sudo mysql # MySQL 접속 mysql> status;
|

MySQL 상태확인
1
| sudo systemctl status mysql
|

MySQL 사용자 등록 및 권한 설정
1 2
| mysql> create user '계정이름'@'%' identified by '패스워드'; mysql> grant all privileges on *.* to '계정이름'@'%' with grant option;
|
인스턴스 인바운드 규칙 설정

외부에서 MySQL 접속확인
MySQL Workbench를 이용하여 접속확인을 한다.
