AWS에 인스턴스 먼저 생성 후 작업해야한다.
Maria DB 설치
ubuntu로 인스턴스 접속 후 코드 작성
$ sudo apt install mariadb-server
$ sudo mysql -u root -p
grant all privileges on *.* to 'root'@'localhost' identified by '비밀번호' with grant option;
코드 입력 후 sudo 없이 mysql 로그인 가능
공동 작업을 할시 로컬뿐 아닌 외부 로컬에서도 권한을 주고싶을때 입력한다.
MariaDB [(None)]> GRANT ALL PRIVILEGES ON *.* to 'root'@'%' IDENTIFIED BY '비밀번호';
show variables like 'char%';
utf8mb4로 되어있는지 확인
select now(); //시스템 날짜와 시간 조회 코드
시스템 설정 시간 확인 후 현재 시간으로 맞추기
현재 시간으로 맞추기 위해서는 MariaDB에서 나온 후 시간 변경해준다
sudo timedatectl set-timezone 'Asia/Seoul';
sudo systemctl restart mysqld; //mariaDB 재실행
변경 후 다시 시스템 시간 확인
mysql에서 나간 뒤 아래 코드로 mysql 환경설정 접속
vi /etc/mysql/my.cnf
초기에 port번호가 주석처리 되어있을 수도 있다. 열어줘야지 외부에서 접속 가능하다.
bind-address IP주소가 설정되어 있는 경우 해당 IP주소만 접속이 가능하다.
외부 로컬도 접속 가능하게 하기 위해선 bind-address를 주석 처리해주거나 아래 코드처럼 설정해 주면 된다.
//모든 IP 허용
bind-address = 0.0.0.0
//특정 IP만 허용
bind-address = 허용할 IP 리스트
bind-address = 192.168.1.1,10.0.0.1
위의 환경설정 재설정 후 DB를 root에서 재시작해준다.
systemctl restart mysql.service