티스토리 뷰

전체 소스는 깃헙에 있습니다.

 

### 토이프로젝트 - 로또API 받아와 번호 누적 통계를 표출하고 누적데이터를 기준으로 자동 번호 생성하기

 

선행 할 것

1. AWS EC2 인스턴스 생성(저 같은 경우 CentOS 7)

2. EC2 보안그룹에서 22번포트와 3306포트 허용 설정

3. 터미널 접속법 숙지

 

 

서버에 접속합니다

아래의 명령어를 입력합니다.

sudo yum -y install http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
sudo yum -y install mysql-community-server
sudo systemctl start mysqld
sudo grep 'temporary password' /var/log/mysqld.log

마지막 명령어를 치면 임시 비밀번호가 나옵니다. 복사 ㄱㄱ

 

mysql -u root -p

비밀번호 입력하라고 나오면 붙여넣기를 하고 접속

 

alter user root@localhost identified by '{설정할 패스워드}';
flush privileges;
commit;
exit;

위 명령어를 사용해 새로운 비밀번호 지정 후 나옵니다.

 

sudo vi /etc/my.cnf

캐릭터셋을 변경하러 갑니다.

 

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[client]
default-character-set = utf8

[mysql]
default-character-set=utf8

[mysqldump]
default-character-set=utf8

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

character-set-server=utf8
collation-server=utf8_general_ci
init_connect=SET collation_connection = utf8_general_ci
init_connect=SET NAMES utf8

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

위와 같이 설정 후 저장해줍니다.

 

sudo systemctl restart mysqld
mysql -u root -p
status 

MySql 서비스를 재시작하고 다시 접속해 캐릭터셋이 잘 바뀌었는지 확인합니다.

 

 

 

사용하는 디비툴에서도 접속되는지 확인합니다.

최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함