오늘 하루종일 EC2 에 mysql server 를 구축했다. 총 4번을 갈아엎으면서 겨우 성공했다.
sudo -s
apt-get update
apt-get install mysql-server
mysql -u root -p
비밀번호 입력창 나오면 그냥 엔터 입력
select Host, User, authentication_string from user;
update user set authentication_string=password('1234') where user='root';
FLUSH PRIVILEGES;
exit
cd /etc/mysql/mysql.conf.d
vi mysqld.cnf
이후 bind-address 를 0.0.0.0으로 변경
(i 클릭 후 변경 -> ctrl + c -> :wq 엔터)
service mysql restart
mysql -u root -p
비밀번호 입력창에 아까 설정해준 1234입력
create user 'username'@'%' identified by 'password';
grant all privileges on *.* to username@'%';
이후 워크벤치에서 해당 mysql 접속.
root계정 처음으로 와서 node 설치
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
3000번 포트로 들어오는 요청을 80번으로 바꿔주는 명령어. 이후 pm2 이용해서 실행.