2024년 3월 20일에 작성되었고, 블로그를 이전하며 옮겨온 포스트입니다.
여기에서 원본을 확인할 수 있습니다.
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
/etc/mysql/mariadb.conf.d/50-server.cnf 파일을 nano 편집기로 열어준다. 방향키를 이용하여 아래 내용을 찾아준다.
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
여기에서 bind-address 부분을 0.0.0.0 으로 변경해 주어 외부에서 접속하는 모든 아이피에 대해 허용해 준다. 수정하면 아래와 같다.
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
위 작업을 완료한 후, 아래 명령어를 실행하여 MariaDB에 접속한다. (만약 root 계정이 아닐 경우 다른 계정을 사용하면 된다.)
mysql -u root -p
그 후 아래 명령을 실행하여, 모든 IP에 대한 접속을 허용해 준다.
- 비밀번호에 root 계정 또는 본인의 데이터베이스 계정에 대한 비밀번호를 입력
- 만약 특정 IP만 허용하고 싶다면 % 부분에 아이피를 입력
GRANT ALL PRIVILEGES ON *.* to root@'%' identified by '비밀번호';
참고
'Backend > Linux' 카테고리의 다른 글
| 리눅스에서 FTP 연결 없이 터미널로 서버에 파일 전송하기 (0) | 2026.08.22 |
|---|