0

Hi I am unable to start mysqld service after I make changes in my.cnf to enable log-bin. After making changes the file looks like below:

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

#This is what I added to enable log-bin

log-bin=/var/log/mysql/
log-bin-index=bin-log.index
max_binlog_size=100M
binlog_format=row
socket=mysql.sock

#That was what I added to enable log-bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

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

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

I am using:

[ec2-user@pip my.cnf.d]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)

Following is the ownership and permissions:

d]$ ls -ld /var/log/mysql
drwxrwxrwx. 2 mysql mysql 23 Sep  8 09:01 /var/log/mysql

Following is the error that I get:

[ec2-user@i.d]$ sudo service mysqld start
Redirecting to /bin/systemctl start  mysqld.service
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

MySQL version is:

Server version: 5.7.19 MySQL Community Server (GPL)

Please let me know if any other detail is required

  • Not sure if this is related, but note the log_bin is not the same as log-bin. – RDFozz Sep 8 '17 at 16:37
  • This is related to binary log in MySQL which is used for database recovery – Kitty Sep 8 '17 at 17:29
  • My point was, the my.cnf file has a commented reference to log underscore bin, while you've set up log dash bin wanted to be sure that the problem isn't a simple typo there. If you already got that, my apologies. – RDFozz Sep 8 '17 at 17:57
  • What was in mysqld's error log? – Rick James Sep 8 '17 at 19:28
  • Just for the sake of clarity, is mysqld actually down ??? If you are not sure, please run service mysqld status. – RolandoMySQLDBA Sep 8 '17 at 19:55
3

According to the manual entry for the mysqld option log-bin:

If you specify this option without also specifying a --server-id, the server is not allowed to start.

So it seems you need something like:

[mysqld]
server-id=1
log-bin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.