°Ô½Ã¹° 1,369°Ç
   
MYSQL Err
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2016-12-14 (¼ö) 14:10 Á¶È¸ : 9382
±ÛÁÖ¼Ò :
                                
Å×½ºÆ® ȯ°æ : Ubuntu 16.04 LTS
# mysql -V
mysql  Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using  EditLine wrapper

Áõ»ó : mysql datadir º¯°æÀ» À§ÇØ mysql.conf ÆÄÀÏÀ» ¼öÁ¤ÈÄ µ¥¸óÀ» Àç½ÃÀÛÇÏ´Â °úÁ¤¿¡¼­ ¾Æ·¡¿Í °°Àº ¿¡·¯¹ß»ý 

# tail -f /var/log/mysql/error.log
2016-12-14T05:02:36.050835Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2016-12-14T05:02:36.050880Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2016-12-14T05:02:36.206919Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-12-14T05:02:36.207217Z 0 [Warning] Can't create test file /mnt/mysql/leekh-vm46.lower-test
2016-12-14T05:02:36.207249Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.16-0ubuntu0.16.04.1) starting as process 30872 ...
2016-12-14T05:02:36.210197Z 0 [Warning] Can't create test file /mnt/mysql/leekh-vm46.lower-test
2016-12-14T05:02:36.210226Z 0 [Warning] Can't create test file /mnt/mysql/leekh-vm46.lower-test
2016-12-14T05:02:36.212774Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-12-14T05:02:36.212821Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-12-14T05:02:36.212847Z 0 [Note] InnoDB: Uses event mutexes
2016-12-14T05:02:36.212865Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-12-14T05:02:36.212882Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-12-14T05:02:36.212918Z 0 [Note] InnoDB: Using Linux native AIO
2016-12-14T05:02:36.213215Z 0 [Note] InnoDB: Number of pools: 1
2016-12-14T05:02:36.213366Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-12-14T05:02:36.214971Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-12-14T05:02:36.224290Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-12-14T05:02:36.226654Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-12-14T05:02:36.236736Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2016-12-14T05:02:36.236801Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2016-12-14T05:02:36.236820Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2016-12-14T05:02:36.837736Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2016-12-14T05:02:36.837896Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-12-14T05:02:36.837946Z 0 [ERROR] Failed to initialize plugins.
2016-12-14T05:02:36.837989Z 0 [ERROR] Aborting

2016-12-14T05:02:36.838038Z 0 [Note] Binlog end
2016-12-14T05:02:36.838186Z 0 [Note] Shutting down plugin 'CSV'
2016-12-14T05:02:36.838250Z 0 [Note] Shutting down plugin 'MyISAM'
2016-12-14T05:02:36.838808Z 0 [Note] /usr/sbin/mysqld: Shutdown complete


# dmess -T 
[Wed Dec 14 14:00:03 2016] audit: type=1400 audit(1481691603.708:3941): apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/mnt/mysql/leekh-vm46.lower-test" pid=30428 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=111 ouid=111
[Wed Dec 14 14:00:03 2016] audit: type=1400 audit(1481691603.708:3942): apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/mnt/mysql/leekh-vm46.lower-test" pid=30428 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=111 ouid=111
[Wed Dec 14 14:00:03 2016] audit: type=1400 audit(1481691603.736:3943): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/mnt/mysql/ibdata1" pid=30428 comm="mysqld" requested_mask="wr" denied_mask="wr" fsuid=111 ouid=111


:: aa-status - Displays various information about the currently loaded AppArmor policy.
# aa-status 
apparmor module is loaded.
13 profiles are loaded.
13 profiles are in enforce mode.
   /sbin/dhclient
   /usr/bin/lxc-start
   /usr/bin/ubuntu-core-launcher
   /usr/lib/NetworkManager/nm-dhcp-client.action
   /usr/lib/NetworkManager/nm-dhcp-helper
   /usr/lib/connman/scripts/dhclient-script
   /usr/lib/lxd/lxd-bridge-proxy
   /usr/sbin/mysqld
   /usr/sbin/tcpdump
   lxc-container-default
   lxc-container-default-cgns
   lxc-container-default-with-mounting
   lxc-container-default-with-nesting
0 profiles are in complain mode.
2 processes have profiles defined.
2 processes are in enforce mode.
   /sbin/dhclient (951) 
   /sbin/dhclient (1010) 
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.


Á¶Ä¡
¹æ¹ý1) mysql ¼­ºñ½º Apparmor º¸¾ÈÁ¤Ã¥ disable
# apt install apparmor-utils

# aa-disable /etc/apparmor.d/usr.sbin.mysqld 
Disabling /etc/apparmor.d/usr.sbin.mysqld.

# aa-status 
apparmor module is loaded.
12 profiles are loaded.
12 profiles are in enforce mode.
   /sbin/dhclient
   /usr/bin/lxc-start
   /usr/bin/ubuntu-core-launcher
   /usr/lib/NetworkManager/nm-dhcp-client.action
   /usr/lib/NetworkManager/nm-dhcp-helper
   /usr/lib/connman/scripts/dhclient-script
   /usr/lib/lxd/lxd-bridge-proxy
   /usr/sbin/tcpdump
   lxc-container-default
   lxc-container-default-cgns
   lxc-container-default-with-mounting
   lxc-container-default-with-nesting
0 profiles are in complain mode.
2 processes have profiles defined.
2 processes are in enforce mode.
   /sbin/dhclient (951) 
   /sbin/dhclient (1010) 
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.


¹æ¹ý2) Apparmor ¼­ºñ½º¿¡ mysql µð·ºÅ丮 º¯°æ
# vim /etc/apparmor.d/usr.sbin/mysqld
# Allow data dir access
# ÁÖ¼®Ã³¸® /var/lib/mysql/ r,
# ÁÖ¼®Ã³¸® /var/lib/mysql/** rwk,
  /mnt/mysql/ r,
  /mnt/mysql/** rwk,

service apparmor restart
# service mysql start



À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.