The following error was thrown while i was enabling mysql binary logs
Jul 3 07:07:44 localhost mysqld: 2017-07-03T07:07:44.593999Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.18-log) starting as process 9078 ...
Jul 3 07:07:44 localhost mysqld: 2017-07-03T07:07:44.596348Z 0 [ERROR] You have enabled the binary log, but you haven't provided the mandatory server-id. Please refer to the proper server start-up parameters documentation
Mysql Binary Log
The “binary log” file contains the “events” that describe database changes such as table creation operations or changes to table data. This is not used for any read statements like “show” or “select”.
To enable the binary log, start the server with the following option
This logging is used mainly for
In replication, the binary log on the master server provides the records of changes to be sent to slave nodes . These records will then get executes on slaves .
If you are taking mysql full backups hourly, during a recovery, once the backup has been restored, the events in the binary log that were recorded after the backup was made are re-executed to ensure zero data loss.
Binary logging makes the mysql performance slightly slower. But, the benefits of the “binary log” in enabling you to set up master-slave replication and for mysql recovery operations generally outweigh this small performance decrement. I would recommend to run the mysql with “bin-log” enabled even if you don’t use it for replication.
How to fix the error “you haven’t provided the mandatory server-id” ?
To enable mysql binary logging, we need to set the mysql option “server-id” in the configuration.
server-id = 1
If it is a master server, set “server-id=1” . On slaves set any other number. But make sure that same number is not set on any of other slaves. Restart the mysql once changes are made in the configuration file. You wont see this error once server-id is set properly.