由于 Apparmor 错误,MySQL 服务无法启动

由于 Apparmor 错误,MySQL 服务无法启动

我刚刚从 Ubuntu Server 14.04 升级到 16.04,但在运行 MySQL 5.7 时遇到了问题。我收到以下错误;

2017-08-21T10:02:39.769552Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-08-21T10:02:39.769640Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-08-21T10:02:39.922215Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-08-21T10:02:39.923667Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.19-0ubuntu0.16.04.1) starting as process 5469 ...
2017-08-21T10:02:39.927514Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-08-21T10:02:39.927541Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-08-21T10:02:39.927548Z 0 [Note] InnoDB: Uses event mutexes
2017-08-21T10:02:39.927554Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-08-21T10:02:39.927560Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-08-21T10:02:39.927566Z 0 [Note] InnoDB: Using Linux native AIO
2017-08-21T10:02:39.927812Z 0 [Note] InnoDB: Number of pools: 1
2017-08-21T10:02:39.927920Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-08-21T10:02:39.929437Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-08-21T10:02:39.938768Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-08-21T10:02:39.940687Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2017-08-21T10:02:39.952276Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-08-21T10:02:39.962900Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-08-21T10:02:39.962987Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-08-21T10:02:39.976448Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2017-08-21T10:02:39.978050Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2017-08-21T10:02:39.978083Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2017-08-21T10:02:39.979411Z 0 [Note] InnoDB: Waiting for purge to start
2017-08-21T10:02:40.029663Z 0 [Note] InnoDB: 5.7.19 started; log sequence number 13724963
2017-08-21T10:02:40.029990Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2017-08-21T10:02:40.030241Z 0 [Note] Plugin 'FEDERATED' is disabled.
2017-08-21T10:02:40.032694Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170821 13:02:40
2017-08-21T10:02:40.035955Z 0 [ERROR] unknown variable 'Max_heap_table_size=380M'
2017-08-21T10:02:40.035992Z 0 [ERROR] Aborting

2017-08-21T10:02:40.036009Z 0 [Note] Binlog end
2017-08-21T10:02:40.036101Z 0 [Note] Shutting down plugin 'ngram'
2017-08-21T10:02:40.036132Z 0 [Note] Shutting down plugin 'partition'
2017-08-21T10:02:40.036142Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2017-08-21T10:02:40.036151Z 0 [Note] Shutting down plugin 'ARCHIVE'
2017-08-21T10:02:40.036159Z 0 [Note] Shutting down plugin 'CSV'
2017-08-21T10:02:40.036168Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2017-08-21T10:02:40.036176Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2017-08-21T10:02:40.036184Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2017-08-21T10:02:40.036205Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2017-08-21T10:02:40.036211Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2017-08-21T10:02:40.036218Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2017-08-21T10:02:40.036224Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2017-08-21T10:02:40.036230Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2017-08-21T10:02:40.036239Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2017-08-21T10:02:40.036246Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2017-08-21T10:02:40.036255Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2017-08-21T10:02:40.036262Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2017-08-21T10:02:40.036268Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2017-08-21T10:02:40.036277Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2017-08-21T10:02:40.036291Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2017-08-21T10:02:40.036323Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2017-08-21T10:02:40.036331Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2017-08-21T10:02:40.036342Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2017-08-21T10:02:40.036361Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2017-08-21T10:02:40.036383Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2017-08-21T10:02:40.036390Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2017-08-21T10:02:40.036404Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2017-08-21T10:02:40.036413Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2017-08-21T10:02:40.036420Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2017-08-21T10:02:40.036427Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2017-08-21T10:02:40.036433Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2017-08-21T10:02:40.036446Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2017-08-21T10:02:40.036456Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2017-08-21T10:02:40.036471Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2017-08-21T10:02:40.036479Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2017-08-21T10:02:40.036488Z 0 [Note] Shutting down plugin 'InnoDB'
2017-08-21T10:02:40.036582Z 0 [Note] InnoDB: FTS optimize thread exiting.
2017-08-21T10:02:40.036787Z 0 [Note] InnoDB: Starting shutdown...
2017-08-21T10:02:40.137057Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2017-08-21T10:02:40.137346Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 170821 13:02:40
2017-08-21T10:02:41.646864Z 0 [Note] InnoDB: Shutdown completed; log sequence number 13724982
2017-08-21T10:02:41.650685Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2017-08-21T10:02:41.650720Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2017-08-21T10:02:41.650836Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2017-08-21T10:02:41.650864Z 0 [Note] Shutting down plugin 'MyISAM'
2017-08-21T10:02:41.650898Z 0 [Note] Shutting down plugin 'MEMORY'
2017-08-21T10:02:41.650909Z 0 [Note] Shutting down plugin 'sha256_password'
2017-08-21T10:02:41.650931Z 0 [Note] Shutting down plugin 'mysql_native_password'
2017-08-21T10:02:41.651224Z 0 [Note] Shutting down plugin 'binlog'
2017-08-21T10:02:41.651494Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

服务 mysql 状态

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (start-post) (Result: exit-code) since Mon 2017-08-21 13:23:29 EAT; 4s ago
  Process: 9984 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 9975 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 9984 (code=exited, status=1/FAILURE);         : 9985 (mysql-systemd-s)
   CGroup: /system.slice/mysql.service
           └─control
             ├─ 9985 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─10021 sleep 1

Aug 21 13:23:29 loghost systemd[1]: Starting MySQL Community Server...
Aug 21 13:23:31 loghost systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

尾部-f / var / log / syslog | grep apparmor

Aug 21 13:23:30 loghost kernel: [ 9839.617741] audit: type=1400 audit(1503311009.999:726): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/9984/status" pid=9984 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=110 ouid=110
Aug 21 13:23:30 loghost kernel: [ 9839.617789] audit: type=1400 audit(1503311009.999:727): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=9984 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=110 ouid=0
Aug 21 13:23:30 loghost kernel: [ 9839.617878] audit: type=1400 audit(1503311009.999:728): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/9984/status" pid=9984 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=110 ouid=110

请提供建议或给我指明正确的方向

答案1

2017-08-21T10:02:40.035955Z 0 [ERROR] unknown variable 'Max_heap_table_size=380M'

看起来这可能是个不错的起点。您能确保此指令在配置文件中的正确位置吗?它应该在部分下[mysqld]

我查看了您的 AppArmor 错误,看起来这些审核失败可能不会影响服务器的运行 - 只需要修复服务器配置。

相关内容