Ncloud Mysql, MariaDB 환경설정 파일 my.cnf 위치 안내입니다

개요

Ncloud (네이버 클라우드)에서 Mysql MariaDB 환경설정 파일인 my.cnf 파일이 CentOS, Ubuntu, Rocky Linux OS 별로 어떤 경로에 위치하고 있는지 정리해보겠습니다.

CentOS

우선 CentOS 부터 살펴보겠습니다.

MySQL

MySQL은 my.cnf 파일이 /etc/ 바로 밑에 위치합니다.

/etc/my.cnf
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

MariaDB

MariaDB에서도 my.cnf 파일이 /etc/ 바로 밑에 위치하기는 하지만, 실제로 /etc/my.cnf 파일을 열어보면 다음과 같이 my.cnf.d 디렉토리에 있는 파일을 include만 하게 되어 있습니다.
즉, my.cnf 파일에 설정을 추가해도 되지만 가능하면 하위의 각각의 설정 파일에 추가하는 것이 좋습니다.

/etc/my.cnf.d/server.cnf
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내
  • /etc/my.cnf.d/server.cnf 파일을 열어 보면 다음과 같이 구성 되어 있습니다.
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

Ubuntu

Ubuntu에서는 my.cnf 파일이 /etc/mysql 밑에 위치합니다.

/etc/mysql/my.cnf

MySQL

Ubuntu 20.04, MySQL 8.0에서는 아래의 3가지 파일을 주로 확인하면 되겠습니다.

/etc/mysql/my.cnf
/etc/mysql/mysql.conf.d/mysql.cnf
/etc/mysql/mysql.conf.d/mysqld.cnf
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

먼저 /etc/mysql/my.cnf 파일을 열어 보면 다음과 같이 conf.d 디렉토리와 mysql.conf.d 디렉토리에 있는 파일을 include 하도록 되어 있습니다.

Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

/etc/mysql/ 디렉토리의 파일과 서브 디렉토리 구조를 살펴보면 다음과 같습니다. 여기서 mysql.conf.d 디렉토리에 있는 mysql.cnf 파일과 mysqld.cnf 파일을 살펴보겠습니다.

Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내
  • /etc/mysql/mysql.conf.d/mysql.cnf
    이 파일을 열어 보면 다음과 같이 [The MySQL database client configuration file]이라고 되어 있습니다.
    즉, MySQL Client 관련 설정은 이곳에 지정하면 되겠습니다.
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내
  • /etc/mysql/mysql.conf.d/mysqld.cnf
    이 파일을 열어 보면 다음과 같이 [The MySQL database server configuration file]이라고 되어 있습니다.
    즉, MySQL Server 관련 설정은 이곳에 지정하면 되겠습니다.
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

MariaDB

Ubuntu 20.04, MariaDB 10.3에서는 아래의 4가지 파일을 주로 확인하면 되겠습니다.

/etc/mysql/my.cnf
/etc/mysql/mariadb.cnf
/etc/mysql/mariadb.conf.d/50-client.cnf
/etc/mysql/mariadb.conf.d/50-server.cnf
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

그런데, /etc/mysql/my.cnf 파일의 정보를 확인해보면 결국 /etc/mysql/mariadb.cnf 파일의 심볼릭 링크라는 것을 알 수 있습니다. 그러므로 /etc/mysql/mariadb.cnf 파일을 살펴보겠습니다.

Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

/etc/mysql/mariadb.cnf 파일을 열어 보면 다음과 같이 conf.d 디렉토리와 mariadb.conf.d 디렉토리에 있는 파일을 include 하도록 되어 있습니다.

Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

/etc/mysql/ 디렉토리의 파일과 서브 디렉토리 구조를 살펴보면 다음과 같습니다.
여기서 mariadb.conf.d 디렉토리에 있는 50-client.cnf 파일과 50-server.cnf 파일을 살펴보겠습니다.

Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내
  • /etc/mysql/mariadb.conf.d/50-client.cnf
    이 파일을 열어 보면 다음과 같이 [This group is read by the client library]이라고 되어 있습니다.
    즉, MariaDB Client 관련 설정은 이곳에 지정하면 되겠습니다.
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내
  • /etc/mysql/mariadb.conf.d/50-server.cnf
    이 파일을 열어 보면 다음과 같이 [These groups are read by MariaDB server]이라고 되어 있습니다.
    즉, MariaDB Server 관련 설정은 이곳에 지정하면 되겠습니다.
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

Rocky Linux

MySQL

Rocky Linux도 MySQL은 my.cnf 파일이 /etc/ 바로 밑에 위치합니다.

/etc/my.cnf
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

MariaDB

Rocky Linux에서는 mariadb-server.cnf 파일입니다.

/etc/my.cnf.d/mariadb-server.cnf

MariaDB에서도 my.cnf 파일이 /etc/ 바로 밑에 위치하기는 하지만, 실제로 /etc/my.cnf 파일을 열어보면 다음과 같이 my.cnf.d 디렉토리에 있는 파일을 include만 하게 되어 있습니다.
즉, my.cnf 파일에 설정을 추가해도 되지만 가능하면 하위의 각각의 설정 파일에 추가하는 것이 좋습니다.

Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내
  • /etc/my.cnf.d/mariadb-server.cnf 파일을 열어 보면 다음과 같이 구성 되어 있습니다.
Ncloud Mysql, mariadb 환경설정 파일 my.cnf 위치 안내

참고 URL

  1. Ncloud MySQL 서버 이미지 사용 가이드
  2. Ncloud MariaDB 서버 이미지 사용 가이드