diff --git a/tasks/user.yml b/tasks/user.yml
index 18afae24e0894fc1ccda9cd3cabd2eb570670129..639723ffcac3b9cd05f74521358f141e6b7928b9 100644
--- a/tasks/user.yml
+++ b/tasks/user.yml
@@ -37,3 +37,10 @@
   with_items: '{{ mysql_external_users|default([]) }}'
   notify:
     - Restart MySQL
+
+- name: Add netdata user
+  mysql_user:
+    user: netdata
+    host: localhost
+    check_implicit_admin: yes
+    priv: '*.*:USAGE,REPLICATION CLIENT,PROCESS'
diff --git a/templates/etc-mysql-mysql-conf-d-mysqld.cnf b/templates/etc-mysql-mysql-conf-d-mysqld.cnf
index 3cf255cb4648fc02bf90ccad890b11c3c7f8f9c2..7288f52b494d8047d15511e39c34698d1dfc6114 100644
--- a/templates/etc-mysql-mysql-conf-d-mysqld.cnf
+++ b/templates/etc-mysql-mysql-conf-d-mysqld.cnf
@@ -21,28 +21,28 @@
 # The following values assume you have at least 32M ram
 
 [mysqld_safe]
-socket		= /var/run/mysqld/mysqld.sock
-nice		= 0
+socket    = /var/run/mysqld/mysqld.sock
+nice    = 0
 
 [mysqld]
 #
 # * Basic Settings
 #
-user		= mysql
-pid-file	= /var/run/mysqld/mysqld.pid
-socket		= /var/run/mysqld/mysqld.sock
-port		= 3306
-basedir		= /usr
-datadir		= /var/lib/mysql
-tmpdir		= /tmp
-lc-messages-dir	= /usr/share/mysql
+user    = mysql
+pid-file  = /var/run/mysqld/mysqld.pid
+socket    = /var/run/mysqld/mysqld.sock
+port    = 3306
+basedir    = /usr
+datadir    = /var/lib/mysql
+tmpdir    = /tmp
+lc-messages-dir  = /usr/share/mysql
 skip-external-locking
 # skip-name-resolve
 explicit_defaults_for_timestamp = 1
 #
 # Instead of skip-networking the default is now to listen only on
 # localhost which is more compatible and is not less secure.
-bind-address		= {{ mysql_bind }}
+bind-address    = {{ mysql_bind }}
 #
 # * Fine Tuning
 #
@@ -93,12 +93,16 @@ slow_query_log_file = /var/log/mysql/slow.log
 # The following can be used as easy to replay backup logs or for replication.
 # note: if you are setting up a replication secondary, see README.Debian about
 #       other settings you may need to change.
-#server-id		= 1
-#log_bin			= /var/log/mysql/mysql-bin.log
-expire_logs_days	= {{ mysql_expire_logs_days }}
-max_binlog_size   = {{ mysql_max_binlog_size }}
-#binlog_do_db		= include_database_name
-#binlog_ignore_db	= include_database_name
+{% if mysql_repl_primary or mysql_repl_secondary %}
+server-id = {{ mysql_server_id }}
+{% endif %}
+{% if mysql_repl_primary %}
+log_bin = /var/log/mysql/mysql-bin.log
+expire_logs_days = {{ mysql_expire_logs_days }}
+max_binlog_size = {{ mysql_max_binlog_size }}
+# binlog_do_db = THIS IS UNSET, LOG EVERYTHING EXCEPT binlog_ignore_db
+binlog_ignore_db = manual,mysql
+{% endif %}
 #
 # * InnoDB
 #