mysql 无法从版本 16.04.1 启动

mysql 无法从版本 16.04.1 启动

MySQL 无法在 Ubuntu 16.04 上启动

错误代码:

mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (start-post) (Result: exit-code) since Tue 2016-11-29 15:13:28 EST; 28s ago
  Process: 4925 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 4922 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 4925 (code=exited, status=1/FAILURE);         : 4927 (mysql-systemd-s)
    Tasks: 2
   Memory: 580.0K
      CPU: 632ms
   CGroup: /system.slice/mysql.service
           └─control
             ├─4927 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─5014 sleep 1

    Nov 29 15:13:28 vmdb-master systemd[1]: Starting MySQL Community Server...
    Nov 29 15:13:29 vmdb-master systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
===========================================
2016-11-29T20:53:54.626501Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2016-11-29T20:53:54.626576Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2016-11-29T20:53:54.785332Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-11-29T20:53:54.785371Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2016-11-29T20:53:54.785490Z 0 [Warning] Can't create test file /mnt/raid0/mysql/vmdb-master.lower-test
2016-11-29T20:53:54.785542Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.16-0ubuntu0.16.04.1) starting as process 5291 ...
2016-11-29T20:53:54.788939Z 0 [Warning] Can't create test file /mnt/raid0/mysql/vmdb-master.lower-test
2016-11-29T20:53:54.788990Z 0 [Warning] Can't create test file /mnt/raid0/mysql/vmdb-master.lower-test
2016-11-29T20:53:54.791836Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-11-29T20:53:54.791887Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-11-29T20:53:54.791895Z 0 [Note] InnoDB: Uses event mutexes
2016-11-29T20:53:54.791918Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-11-29T20:53:54.791925Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-11-29T20:53:54.791931Z 0 [Note] InnoDB: Using Linux native AIO
2016-11-29T20:53:54.792247Z 0 [Note] InnoDB: Number of pools: 1
2016-11-29T20:53:54.792376Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-11-29T20:53:54.794969Z 0 [Note] InnoDB: Initializing buffer pool, total size = 4G, instances = 8, chunk size = 128M
2016-11-29T20:53:55.097378Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-11-29T20:53:55.132818Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-11-29T20:53:55.142992Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2016-11-29T20:53:55.143032Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2016-11-29T20:53:55.143043Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2016-11-29T20:53:55.744170Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2016-11-29T20:53:55.744194Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-11-29T20:53:55.744207Z 0 [ERROR] Failed to initialize plugins.
2016-11-29T20:53:55.744214Z 0 [ERROR] Aborting

2016-11-29T20:53:55.744223Z 0 [Note] Binlog end
2016-11-29T20:53:55.744291Z 0 [Note] Shutting down plugin 'CSV'
2016-11-29T20:53:55.744301Z 0 [Note] Shutting down plugin 'MyISAM'
2016-11-29T20:53:55.744627Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
--------------------------------------------

文件所在目录设置为 777,但仍然抱怨无法写入。

答案1

这里提到了您的错误:

2016-11-29T20:53:55.142992Z 0 [错误] InnoDB:innodb_system 数据文件“ibdata1”必须可写

您应该使用 sudo 启动 mysql 服务,或者确保启动 mysql 服务的用户帐户在 innodb_system 的位置具有写访问权限

答案2

回答:

必须编辑 /etc/apparmor.d/usr.sbin/mysqld 并添加 mysql 安装的实际位置。不知道为什么它之前没有这些信息,也不知道在没有这些信息的情况下它是如何运行的,但这是 apparmor 拒绝 mysql 访问它自己的目录。

相关内容