> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/release_all_locks.md).

# RELEASE\_ALL\_LOCKS

{% hint style="info" %}
`RELEASE_ALL_LOCKS` is available from [MariaDB 10.5.2](/docs/release-notes/community-server/old-releases/10.5/10.5.2.md).
{% endhint %}

## Syntax

```bnf
RELEASE_ALL_LOCKS()
```

## Description

Releases all named locks held by the current session. Returns the number of locks released, or `0` if none were held.

Statements using the `RELEASE_ALL_LOCKS` function are [not safe for statement-based replication](/docs/server/ha-and-performance/standard-replication/unsafe-statements-for-statement-based-replication.md).

## Examples

```sql
SELECT RELEASE_ALL_LOCKS();
+---------------------+
| RELEASE_ALL_LOCKS() | 
+---------------------+
|                   0 |
+---------------------+

SELECT GET_LOCK('lock1',10);
+----------------------+
| GET_LOCK('lock1',10) |
+----------------------+
|                    1 |
+----------------------+

SELECT RELEASE_ALL_LOCKS();
+---------------------+
| RELEASE_ALL_LOCKS() | 
+---------------------+
|                   1 |
+---------------------+
```

## See Also

* [GET\_LOCK](/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/get_lock.md)
* [IS\_FREE\_LOCK](/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_free_lock.md)
* [IS\_USED\_LOCK](/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/is_used_lock.md)
* [RELEASE\_LOCK](/docs/server/reference/sql-functions/secondary-functions/miscellaneous-functions/release_lock.md)

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

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