无法在google计算引擎上启用bin日志

wwwo4jvm  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(396)

我想在谷歌的灯堆上设置bin log。一切正常,除了日志箱配置。每当我加上 log-bin = /var/log/mysql/mysql-bin/etc/mysql/mysql.conf.d/mysqld.cnf 文件,然后重新启动mysql。它抛出一个错误


# sudo /etc/init.d/mysql restart

[....] Restarting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
 failed!

/etc/mysql/mysql.conf.d/mysqld.cnf的内容

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
log-error       = /var/log/mysql/error.log
bind-address    = localhost
log-bin         = /var/log/mysql/mysql-bin

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

mysql:root might 具有必需的权限,因为mysql可以登录错误 /var/log/mysql/error.log . 但不管怎样我也试过了

chown -R mysql:mysql /var/log/mysql/
chmod 770 /var/log/mysql/

# and

chown -R mysql:root /var/log/mysql/

我已经尝试过这些帖子中给出的解决方案,但都不适合我
https://serverfault.com/questions/502713/mysql-wont-start-if-i-set-the-log-bin
尝试更改bin日志目录:mysql-bin.index找不到(错误代码:13)
https://dba.stackexchange.com/questions/12346/mysql-bin-log-index-not-found
https://dba.stackexchange.com/questions/97816/cant-enable-binary-logging-index-not-found
https://serverfault.com/questions/382945/why-cant-i-get-the-binlog-in-mysql/383580
mysql中的二进制日志错误
mysql error.log内容

2018-05-31T20:40:15.934303Z 0 [Note] InnoDB: Starting shutdown...
2018-05-31T20:40:16.034693Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2018-05-31T20:40:16.034934Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180531 20:40:16
2018-05-31T20:40:17.487431Z 0 [Note] InnoDB: Shutdown completed; log sequence number 3080730
2018-05-31T20:40:17.489847Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-05-31T20:40:17.489886Z 0 [Note] Shutting down plugin 'MEMORY'
2018-05-31T20:40:17.489893Z 0 [Note] Shutting down plugin 'CSV'
2018-05-31T20:40:17.489898Z 0 [Note] Shutting down plugin 'sha256_password'
2018-05-31T20:40:17.489901Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-05-31T20:40:17.490163Z 0 [Note] Shutting down plugin 'binlog'
2018-05-31T20:40:17.490592Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

详细错误日志错误日志

lf5gs5x2

lf5gs5x21#

这很容易成为您运行的服务器(apparmor或selinux)上的安全设置的问题。请注意,二进制日志实际上并不是一个与通常放在/var/log中的常规文本文件相同意义上的“日志”,无论如何,您可能不想将该文件放在/var/log中。可能是在您运行的设置中,apparmor或selinux规则阻止mysql将任意文件写入/var/log(这些规则超出了常规文件权限的作用,chmod/chown无法避免它们)。您可能需要考虑选择另一个目录来保存bin日志。
也许数据库根目录是一个更好的选择( /var/lib/mysql ,或任何mysql配置为用作存储其数据库文件的位置)。

相关问题