- service로 start 하면 아래와 같이 에러를 뿜어냄
# service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
- mysql 에러 로그 ( /var/log/mysql/error.log )
2018-06-25T06:27:30.280578Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2018-06-25T06:27:30.280642Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2018-06-25T06:27:30.434382Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more detai
2018-06-25T06:27:30.434517Z 0 [Warning] Can't create test file /user/mysql/CN-SGGOLF-BODDB.lower-test
2018-06-25T06:27:30.434584Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.20-0ubuntu0.16.04.1) starting as process 7986 ...
2018-06-25T06:27:30.439078Z 0 [Warning] Can't create test file /user/mysql/CN-SGGOLF-BODDB.lower-test
2018-06-25T06:27:30.439135Z 0 [Warning] Can't create test file /user/mysql/CN-SGGOLF-BODDB.lower-test
2018-06-25T06:27:30.441979Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-06-25T06:27:30.442016Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-25T06:27:30.442028Z 0 [Note] InnoDB: Uses event mutexes
2018-06-25T06:27:30.442037Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-06-25T06:27:30.442046Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2018-06-25T06:27:30.442054Z 0 [Note] InnoDB: Using Linux native AIO
2018-06-25T06:27:30.442368Z 0 [Note] InnoDB: Number of pools: 1
2018-06-25T06:27:30.442505Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-06-25T06:27:30.444230Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2018-06-25T06:27:30.455497Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-06-25T06:27:30.457609Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-06-25T06:27:30.467675Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2018-06-25T06:27:30.467714Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2018-06-25T06:27:30.467731Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-06-25T06:27:31.068951Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-06-25T06:27:31.068984Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-06-25T06:27:31.068998Z 0 [ERROR] Failed to initialize plugins.
2018-06-25T06:27:31.069004Z 0 [ERROR] Aborting
2018-06-25T06:27:31.069013Z 0 [Note] Binlog end
2018-06-25T06:27:31.069066Z 0 [Note] Shutting down plugin 'CSV'
2018-06-25T06:27:31.069079Z 0 [Note] Shutting down plugin 'MyISAM'
2018-06-25T06:27:31.069391Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
----------------------------------------------------------------------------------
※ 에러 로그를 보면 ibdata1 파일에 스기 권한이 없다고 나옴. 권한 문제
1. apparmor 관리자 disable 에 등록하는 방법
http://modudiv.blogspot.com/2018/02/apparmor-mysql-apparmor-disabling.html
http://fngs.tistory.com/26
http://idchowto.com/?p=33168
- apparmor 등록 리스트 보는법? : aa-status
- apparmor 에서 mysql 폴더 권한 수정 방법
vi /etc/apparmor.d/usr.sbin.mysqld 파일을 열어 mysql 설치 폴더의 r -> rw 로 해보기
# Allow data dir access
# /var/lib/mysql/ r,
# /var/lib/mysql/** rwk,
/user/mysql/ r, -> /user/mysql/ rw,
/user/mysql/** rwk,
2. 해당 파일의 권한을 변경
MySQL 이 설치된 폴더( 직접 설치 : /user/mysql ) 에 가보면 파일이 있다. 파일 권한을 664로 변경
위 설정 적용 후 재시작
service apparmor restart
service mysql restart
=> 재시작 해도 aa-status 리스트에 mysqld 가 등록되어 있음, 그래서 서버를 reboot 후 정상 처리
* 참고
https://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_MySQL_%EC%8B%9C%EC%9E%91,_%EC%A0%95%EC%A7%80,_%EC%9E%AC%EC%8B%9C%EC%9E%91,_%EC%83%81%ED%83%9C%ED%99%95%EC%9D%B8
0 댓글