# DBeaver, Mysql 오토커밋 설정 관련

## 1. **DBeaver**

#### 기본 설정:

* DBeaver는 **기본적으로 Auto-Commit이 활성화**되어 있습니다.
* 즉, 데이터를 수정하거나 삽입한 후 별도로 `COMMIT` 명령을 실행하지 않아도 자동으로 적용됩니다.

#### Auto-Commit 끄는 방법:

**(1) 글로벌 설정에서 비활성화**

1. DBeaver 상단 메뉴에서 \*\*`Window > Preferences`\*\*를 클릭합니다.
2. 왼쪽 메뉴에서 \*\*`Database > Transactions`\*\*를 선택합니다.
3. 오른쪽 창에서 **`Default auto-commit mode`** 체크박스를 해제합니다.

<figure><img src="/files/bEZoD5dunsnQtkyZlitE" alt=""><figcaption></figcaption></figure>

1. **`Apply and Close`** 버튼을 클릭합니다.

**(2) 개별 연결에서 비활성화**

1. DBeaver에서 데이터베이스 연결을 마우스 오른쪽 버튼으로 클릭하고 \*\*`Edit Connection`\*\*을 선택합니다.
2. **`Connection settings`** 창에서 **`General`** 탭을 클릭합니다.
3. **`Auto-commit`** 옵션을 찾아 체크를 해제합니다.
4. \*\*`OK`\*\*를 클릭하여 저장합니다.

**(3) 현재 세션에서 비활성화**

1. SQL Editor에서 상태바를 확인합니다.
   * 아래쪽 상태바에 \*\*`Auto-Commit`\*\*이 표시됩니다.
2. \*\*`Auto-Commit`\*\*을 클릭하면 비활성화됩니다.

***

## 2. **MySQL Workbench**

#### 기본 설정:

* MySQL Workbench도 **기본적으로 Auto-Commit이 활성화**되어 있습니다.
* 테이블 데이터를 수정하거나 삽입한 후 별도의 `COMMIT` 명령 없이 즉시 적용됩니다.

#### Auto-Commit 끄는 방법:

**(1) 세션별로 Auto-Commit 끄기**

1. MySQL Workbench에서 데이터베이스에 연결합니다.
2. SQL Editor 화면에서 상태바를 확인합니다.
3. 아래 상태바에 있는 **`Auto-Commit`** 버튼을 클릭하여 비활성화합니다.
   * 버튼이 회색으로 바뀌면 Auto-Commit이 꺼진 상태입니다.
   * 아래 이미지는 Auto-commit이 비활성화 된 상태

<figure><img src="/files/hxoi1le1Ih1t0gWMs7IZ" alt=""><figcaption></figcaption></figure>

**(2) 글로벌 설정에서 비활성화**

MySQL Workbench에는 글로벌 Auto-Commit 비활성화 설정이 없으므로, 세션별로 관리해야 합니다.

**(3) SQL 명령어로 비활성화**

Auto-Commit을 비활성화하려면 세션에서 다음 명령어를 실행합니다:

```sql
SET autocommit = 0;
```

이 명령어는 현재 세션에서 Auto-Commit을 끄고, 명시적으로 `COMMIT`이나 `ROLLBACK` 명령을 실행해야만 변경 사항이 적용됩니다.

***

#### Auto-Commit이 꺼진 상태에서 데이터 변경 적용

Auto-Commit을 비활성화한 상태에서는 명시적으로 `COMMIT` 명령어를 실행해야 변경 사항이 저장됩니다. 예:

```sql
UPDATE users SET name = 'John' WHERE id = 1;
COMMIT;
```

`ROLLBACK`을 실행하면 모든 변경 사항이 취소됩니다:

```sql
sql코드 복사ROLLBACK;
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://team-everywhere.gitbook.io/backend/db-and-sql/05-mysql/dbeaver-mysql.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.
