# SET GLOBAL SQL\_SLAVE\_SKIP\_COUNTER

## Syntax

```sql
SET GLOBAL sql_slave_skip_counter = N
```

## Description

This statement skips the next `N` events from the primary. This is useful for recovering from [replication](/docs/server/ha-and-performance/standard-replication.md) stops caused by a statement.

If multi-source replication is used, this statement applies to the default connection. It could be necessary to change the value of the [default\_master\_connection](/docs/server/ha-and-performance/standard-replication/replication-and-binary-log-system-variables.md) system variable.

Note that, if the event is a [transaction](/docs/server/reference/sql-statements/transactions.md), the whole transaction will be skipped. With non-transactional engines, an event is always a single statement.

This statement is valid only when the replica threads are not running. Otherwise, it produces an error.

The statement does not automatically restart the replica threads.

## Example

```sql
SHOW SLAVE STATUS \G
...
SET GLOBAL sql_slave_skip_counter = 1;
START SLAVE;
```

Multi-source replication:

```sql
SET @@default_master_connection = 'master_01';
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE;
```

## Multiple Replication Domains

`sql_slave_skip_counter` can't be used to skip transactions on a replica if [GTID replication](/docs/server/ha-and-performance/standard-replication/gtid.md) is in use and if [gtid\_slave\_pos](/docs/server/ha-and-performance/standard-replication/gtid.md#gtid_slave_pos) contains multiple [gtid\_domain\_id](/docs/server/ha-and-performance/standard-replication/gtid.md#gtid_domain_id) values. In that case, you'll get an error like the following:

```
ERROR 1966 (HY000): When using parallel replication and GTID with multiple 
 replication domains, @@sql_slave_skip_counter can not be used. Instead, 
 setting @@gtid_slave_pos explicitly can be  used to skip to after a given GTID 
 position.
```

In order to skip transactions in cases like this, you will have to manually change [gtid\_slave\_pos](/docs/server/ha-and-performance/standard-replication/gtid.md#gtid_slave_pos).

## See Also

* [Selectively Skipping Replication of Binlog Events](/docs/server/server-management/server-monitoring-logs/binary-log/selectively-skipping-replication-of-binlog-events.md)

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/replication-statements/set-global-sql_slave_skip_counter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
