# 2단계 - Sql 백업파일 업로드

#### 🗃️ 이 단계는 왜 필요한가요?

직접 제작한 HTML 또는 PHP 프로젝트 중에서 **데이터베이스를 사용하는 웹사이트**의 경우,\
기존에 보유한 DB 백업파일 (`.sql`)을 업로드해야 웹사이트가 제대로 동작합니다.

> 예: 게시판, 회원가입/로그인 기능이 있는 PHP 사이트 등 프레임워크 기반 프로젝트

***

### 📥 phpMyAdmin을 이용한 SQL 백업 복원

#### ✅ 사전 준비

* `.sql` 확장자를 가진 MySQL 백업 파일 (예: `my_site_backup.sql`)

***

#### 🔑 1단계: cPanel 접속

* 대시보드 → **\[cPanel 바로가기]** 버튼 클릭

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

***

#### 🧭 2단계: phpMyAdmin 접속

* cPanel 홈 화면에서 `phpMyAdmin` 아이콘 클릭

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

***

#### 📂 3단계: 사용할 데이터베이스 선택

* 왼쪽 메뉴에서 **\[내 DB 이름]** 클릭

{% hint style="info" %}
대시보드 -> 내서버의 설정버튼 -> DB 이름 정보
{% endhint %}

<figure><img src="/files/5j6EMwln5F0kohrkI7JN" alt=""><figcaption></figcaption></figure>

***

#### ⬆️ 4단계: SQL 파일 업로드

1. 상단 메뉴에서 \[가져오&#xAE30;**]** 탭 클릭
2. \[파일  선택] 버튼을 눌러 `.sql` 파일 선택
3. 하단의 가져오기 버튼 클릭

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

***

#### ✅ 5단계: 업로드 결과 확인

* 업로드가 완료되면 **"Import has been successfully finished"** 메시지가 표시됩니다.
* 좌측 DB 목록에 테이블들이 정상적으로 보이면 완료입니다.

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

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

***

#### ❗️ 오류가 발생했을 경우

* **"Max file size exceeded"**: 파일이 너무 크면 나눠서 업로드하거나 관리자에게 문의해 주세요.
* **"Unknown collation"**: 다른 서버에서 가져온 SQL 백업일 경우 인코딩 충돌이 있을 수 있습니다.

***

### 📝 다음 단계로 이동하세요

백업된 DB가 복원되었으면, `index.php` 또는 관련 PHP 파일에서\
**DB 접속 정보**가 제대로 입력되었는지 확인하세요.\
(예: `mysqli_connect()` 설정 등)

***


---

# 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://s-organization-887.gitbook.io/hostyle-web/undefined/2-sql.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.
