anchor.diff:  
     config = mkIf config.services.mysql.enable {
   
  +    warnings = optional (cfg.extraOptions != null) "services.mysql.`extraOptions` is deprecated, please use services.mysql.`settings`.";
  +
       services.mysql.dataDir =
         mkDefault (if versionAtLeast config.system.stateVersion "17.09" then "/var/lib/mysql"
                    else "/var/mysql");
  +
  +    services.mysql.settings.mysqld = mkMerge [
  +      {
  +        datadir = cfg.dataDir;
  +        bind-address = mkIf (cfg.bind != null) cfg.bind;
  +        port = cfg.port;
  +        plugin-load-add = optional (cfg.ensureUsers != []) "auth_socket.so";
  +      }
  +      (mkIf (cfg.replication.role == "master" || cfg.replication.role == "slave") {
  +        log-bin = "mysql-bin-${toString cfg.replication.serverId}";
  +        log-bin-index = "mysql-bin-${toString cfg.replication.serverId}.index";
  +        relay-log = "mysql-relay-bin";
  +        server-id = cfg.replication.serverId;
  +      })
  +    ];
   
       users.users.mysql = {
         description = "MySQL server user";
  
positive.code:         description = "Location where MySQL stores its table files";
        };
  
        extraOptions = mkOption {
          type = types.lines;
          default = "";
          example = ''
            key_buffer_size = 6G
            table_cache = 1600
  
negative.code:   installOptions =
      "${mysqldOptions} ${lib.optionalString isMysqlAtLeast57 "--insecure"}";
  
    settingsFile = pkgs.writeText "my.cnf" (
      generators.toINI { listsAsDuplicateKeys = true; } cfg.settings +
      optionalString (cfg.extraOptions != null) "[mysqld]\n${cfg.extraOptions}"
    );
  
  in
  
  {
  