【问题标题】:Ubuntu MySQL: Job failed to startUbuntu MySQL:作业无法启动
【发布时间】:2016-01-10 08:36:43
【问题描述】:

我的 Google Cloud 服务器硬盘空间已用完。所以我添加了另一个安装的 HDD,我在其中复制了 MySQL 数据的内容 (/var/lib/mysql/*)。在我尝试重新启动 MySQL 时更新 my.cnf 后,它失败并留下以下错误:

160110 14:10:40 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use$
160110 14:10:40 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
160110 14:10:40 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160110 14:10:40 InnoDB: The InnoDB memory heap is disabled
160110 14:10:40 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160110 14:10:40 InnoDB: Compressed tables use zlib 1.2.8
160110 14:10:40 InnoDB: Using Linux native AIO
160110 14:10:40 InnoDB: Initializing buffer pool, size = 128.0M
160110 14:10:40 InnoDB: Completed initialization of buffer pool
160110 14:10:40  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
160110 14:10:41 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use$
160110 14:10:41 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
160110 14:10:41 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160110 14:10:41 InnoDB: The InnoDB memory heap is disabled
160110 14:10:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160110 14:10:41 InnoDB: Compressed tables use zlib 1.2.8
160110 14:10:41 InnoDB: Using Linux native AIO
160110 14:10:41 InnoDB: Initializing buffer pool, size = 128.0M
160110 14:10:41 InnoDB: Completed initialization of buffer pool
160110 14:10:41  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
160110 14:10:42 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use$
160110 14:10:42 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
160110 14:10:42 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160110 14:10:42 InnoDB: The InnoDB memory heap is disabled
160110 14:10:42 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160110 14:10:42 InnoDB: Compressed tables use zlib 1.2.8
160110 14:10:41 InnoDB: Using Linux native AIO
160110 14:10:41 InnoDB: Initializing buffer pool, size = 128.0M
160110 14:10:41 InnoDB: Completed initialization of buffer pool
160110 14:10:41  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
160110 14:10:42 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use$
160110 14:10:42 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
160110 14:10:42 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160110 14:10:42 InnoDB: The InnoDB memory heap is disabled
160110 14:10:42 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160110 14:10:42 InnoDB: Compressed tables use zlib 1.2.8
160110 14:10:42 InnoDB: Using Linux native AIO
160110 14:10:42 InnoDB: Initializing buffer pool, size = 128.0M
160110 14:10:42 InnoDB: Completed initialization of buffer pool
160110 14:10:42  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

我试过 chmod 777 和 chown mysql:mysql 到挂载的文件夹 (/var/www/html/DB/) 但结果是一样的。使用 chown 后,我什至可以看到所有者现在是 mysql。那么为什么 MySQL 无法访问该文件夹呢?

我在这里看到了类似的问题,但大多数接受的答案都是重新安装 MySQL。这不是我的解决方案。它只是绕过问题。有更好的答案吗?

【问题讨论】:

  • 您是否做了它告诉您要做的另一件事(“请运行 mysql_upgrade 来创建它。”)?
  • 检查子文件夹的权限和所有者。您可以查看原始文件夹
  • @Pekka웃:我已经尝试过了,输出如下:# mysql_upgrade 寻找 'mysql' 为:mysql 寻找 'mysqlcheck' 为:mysqlcheck 致命错误:升级失败
  • @BerndBuffen:我已将所有者设置为 mysql:mysql。还是一样。

标签: mysql ubuntu


【解决方案1】:

你能检查一下你是否已经设置了你必须在 my.cnf 中更改目录路径的所有配置文件

还要确保您已更改 mysqld 的配置文件,这意味着您必须更新 AppArmor 配置文件,以便它可以获取新目录。

查看此链接https://blogs.oracle.com/jsmyth/entry/apparmor_and_mysql

我希望这会奏效!!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-23
    • 1970-01-01
    • 2015-07-13
    • 2017-04-30
    • 2021-03-28
    • 1970-01-01
    • 2015-03-26
    相关资源
    最近更新 更多