연구실:Tips

Maria DB 외부 접속 허용하기 (Ubuntu 22.04 환경)

작성자 정보

  • za9uar 작성
  • 작성일

컨텐츠 정보

본문

# 시스템 정보

Ubuntu 22.04.1 LTS

mariadb  Ver 15.1 Distrib 10.6.12-MariaDB


1. 설정 파일

# vi /etc/mysql/mariadb.conf.d/50-server.cnf

# 0.0.0.0 으로 바인딩 IP를 전체 허용으로 변경

 

37fc457b0a60d42cf2f75da31403658e_1686500735_1429.png

2. mariadb 접속 host 변경

MariaDB [(none)]> select host,user,plugin,authentication_string from mysql.user;

+-----------+-------------+-----------------------+-----------------------+

| Host      | User        | plugin                | authentication_string |

+-----------+-------------+-----------------------+-----------------------+

| localhost | mariadb.sys | mysql_native_password |                       |

| localhost | root        | mysql_native_password | invalid               |

| localhost | mysql       | mysql_native_password | invalid               | 

+-----------+-------------+-----------------------+-----------------------+

3 rows in set (0.001 sec)


# localhost로 되어 있으면 외부 접속이 안됨.

# 아래 명령어로 % (전체 허용) 변경


MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by '비밀번호';

Query OK, 0 rows affected (0.002 sec)


MariaDB [(none)]> select host,user,plugin,authentication_string from mysql.user;

+-----------+-------------+-----------------------+-------------------------------------------+

| Host      | User        | plugin                | authentication_string                     |

+-----------+-------------+-----------------------+-------------------------------------------+

| localhost | mariadb.sys | mysql_native_password |                                           |

| localhost | root        | mysql_native_password | invalid                                   |

| localhost | mysql       | mysql_native_password | invalid                                   |

| %         | root        | mysql_native_password | *AD4672C5B55                      |

+-----------+-------------+-----------------------+-------------------------------------------+

4 rows in set (0.001 sec)


# 적용


MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.001 sec)


3. 재시작

# service mariadb restart

 * Stopping MariaDB database server mariadbd                                                           [ OK ]

 * Starting MariaDB database server mariadbd                                                           [ OK ]


4. 정상 접속 확인

37fc457b0a60d42cf2f75da31403658e_1686500807_8602.png
 

[이 게시물은 최고관리자님에 의해 2024-03-20 10:01:23 운동장:자유게시판에서 이동 됨]

관련자료

댓글 0
등록된 댓글이 없습니다.

최근글


  • 글이 없습니다.

새댓글