인디노트

MySQL Data Directory 변경후 mysqld_tmp_file case_insensitive test.lower-test 의 SELinux 관련 대처 방법 본문

개발 플랫폼 및 언어/DB 기술

MySQL Data Directory 변경후 mysqld_tmp_file case_insensitive test.lower-test 의 SELinux 관련 대처 방법

인디개발자 2021. 4. 14. 09:01

MySQL 의 DATA 저장 위치를 바꾼후 mysqld 를 실행하면 로그 출력과 함께 MySQL 이 가동되지 못할 경우가 있습니다.

[Warning] [MY-010091] [Server] Can't create test file /DATA/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
[System] [MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.21) starting as process 7366
[Warning] [MY-010091] [Server] Can't create test file /DATA/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
[Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /DATA/mysql/ is case insensitive
[ERROR] [MY-010119] [Server] Aborting

chown 명령으로 해당 데이터 폴더를 mysql 계정에 할당 한 경우이 이런 문제는 대부분 이 경우 selinux 관련입니다.

 

SELinux 문제인지 확인하려면

setenforce 0

를 주고 mysql 서비스를 가동해 보는 것입니다. 0을 주면 SELinux 의 가동을 (임시로) 중단시키는 것이며 1 을 주면 SELinux 를 다시 가동 시키게 됩니다.

 

새로 옮긴 DATA 디렉토리가 /DATA/mysql 이라면

1) $ su -
2) # getenforce
3) # semanage fcontext -a -t mysqld_db_t "/DATA/mysql(/.*)?"
4) # restorecon -Rv /DATA/mysql
5) # chcon -R -u system_u -r object_r -t mysqld_db_t /DATA/mysql
6) # ls -lh -Zd /DATA/mysql

1) root 권한으로 전환 한다. 필요한 경우에 해당.
2) SELinux 의 현재상태를 가져온다. 이런 경우 대부분 Enforcing 를 출력한다.
3) semanage 명령을 통해 옮긴 디렉토리 및 하위 디렉토리에 보안 컨텍스트 객체를 추가한다.
4) 보안 컨텍스트를 재설정 한다.
5) 이 과정은 (3) 를 했으면 필요 없다. 그래도 해 주자.
6) 보안 컨텍스트가 정상적으로 반영됬는지 ls 명령에 Z 옵션을 주어 확인 한다.

위와 같이 처리한 후 mysqld 를 가동 시키시기 바랍니다.

 

반응형
Comments