简体   繁体   English

如何启用mysql bin日志

[英]how to enable mysql bin log

OS: Mac OS X Hi Sierra(10.13.1) 操作系统:Mac OS X Hi Sierra(10.13.1)
MySQL: 5.7.20 (install by homebrew) MySQL:5.7.20(通过自制程序安装)

I want to enable bin log, so I should edit my.cnf file, 我想启用bin日志,所以我应该编辑my.cnf文件,
I typed below command to find my.cnf file 我键入以下命令来找到my.cnf文件
mysql --verbose --help | grep my.cnf

and result /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf 结果/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf
/etc/my.cnf, /etc/mysql/my.cnf isn't exist in my mac. /etc/my.cnf、/etc/mysql/my.cnf在我的Mac中不存在。

So, I edit /usr/local/etc/my.cnf file. 因此,我编辑了/usr/local/etc/my.cnf文件。
[mysqld] bind-address = 127.0.0.1 log-bin = ~/log

and I start mysql but it can't start. 我启动了mysql但无法启动。
mysql.server start Starting MySQL ... ERROR! The server quit without updating PID file (/usr/local/var/mysql/*.pid).

When I remove bin-log in my.cnf, it can start! 当我删除my.cnf中的bin-log时,它可以启动!
How can I enable bin log?? 如何启用bin日志?

Standby counsel 待命律师

I missed server-id property in my.cnf... 我错过了my.cnf中的server-id属性...

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

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