简体   繁体   English

Ubuntu MySQL:作业无法启动

[英]Ubuntu MySQL: Job failed to start

My Google Cloud server HDD space run out. 我的Google Cloud服务器硬盘空间已用完。 So I've added another mounted HDD where I copied contents of MySQL data (/var/lib/mysql/*). 因此,我添加了另一个安装的HDD,用于复制MySQL数据的内容(/ var / lib / mysql / *)。 After updating my.cnf when I tried to restart MySQL it fails leaving the following error: 在更新my.cnf后,当我尝试重新启动MySQL时失败,并留下以下错误:

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.

I've tried chmod 777 and chown mysql:mysql to the mounted folder (/var/www/html/DB/) but the result is same. 我已经尝试过chmod 777并将chown mysql:mysql挂载到已安装的文件夹(/ var / www / html / DB /),但是结果是相同的。 After using chown, I can even see that the owner is now mysql. 使用chown之后,我什至可以看到所有者现在是mysql。 So why MySQL is failing to access the folder? 那么,为什么MySQL无法访问该文件夹?

I've seen similar question here but most of the accepted answers are reinstalling MySQL. 我在这里看到过类似的问题,但是大多数可接受的答案都是重新安装MySQL。 That's not a solution to me. 那不是我的解决方案。 It's simply bypassing the problem. 它只是绕过了问题。 Any better answer? 有更好的答案吗?

Can you check that you have set all your config file where you have to change directory path in my.cnf 您可以检查一下是否已设置所有配置文件,但必须在my.cnf中更改目录路径

Also make sure you have change the profile for mysqld that mean you have to update AppArmor config file so it will get the new directory. 还要确保已更改mysqld的配置文件,这意味着您必须更新AppArmor配置文件,以便它将获得新目录。

Check this link https://blogs.oracle.com/jsmyth/entry/apparmor_and_mysql 检查此链接https://blogs.oracle.com/jsmyth/entry/apparmor_and_mysql

I hope this will work!! 我希望这会工作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM