aws EC2 mysql 외부접속 허용하기

Mingtorr·2021년 4월 13일
0
post-thumbnail

다른 내용은 아래의 링크와 동일합니다.
AWS EC2로 홈페이지 배포하기(5) nginx에 mysql 연결하기

달라진 부분은 mysql 에서 외부 접속 허용할 때 명령어가 변경되었습니다.
우선 aws ubuntu 자체의 외부접속을 허용해 주어야 합니다.

cd /etc/mysql/mysql.conf.d
vi mysqld.cnf
bind-address 값을 0.0.0.0 으로 수정
wq로 저장후 vi 종료

변경이 완료되면 아래와 같은 상태가 됩니다.

이후 mysql로 접속하여 아래처럼 입력하면 됩니다.

grant all privileges on *.* to 'root'@'%' with grant option;

더이상 identified 명령어가 실행되지 않습니다.

trouble shooting

기존처럼 아래의 명령어를 입력하면 오류가 발생합니다.

grant all privileges on *.* to root@'%' identified by '루트계정 비밀번호'; 

mysql> grant all privileges on *.* to root@'%' identified by '루트계정 비밀번호';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by '루트계정 비밀번호'' at line 1
profile
츄르 값 벌기 위해 코딩하는 아키텍쳐

0개의 댓글