# Create MySQL Database Instance

ระบบจะสร้าง Database Schema ให้ 1 Schema สำหรับ Database Instance นั้น กำหนดชื่อว่า DB-Default โดยมี Collation คือ utf8 และ Character Set คือ utf8\_general\_ci และสามารถสร้าง Database Schema เพิ่มได้ภายหลัง ([ขั้นตอนการสร้าง Database Schema](/ncs-documents/database-as-a-service/sql-database/manage-sql-database-schema/create-database-schema.md)) โดยจะไม่ให้สิทธิ Root User กับผู้ใช้งาน

## Instructions

### 1. เลือก Availability Zone

เลือก Availability Zone ของ Database Instance ที่ต้องการได้จาก tab “Availability Zone” และที่มุมซ้าย โดยปัจจุบันจะให้บริการเฉพาะ NCP-BKK และจะเปิดให้บริการเพิ่มในอนาคต

<figure><img src="/files/w6FZjblMOiRHxZfHacaG" alt=""><figcaption><p>เลือก Availability Zone</p></figcaption></figure>

### 2. กำหนดชื่อของ Database Instance

กำหนดชื่อของ Database Instance ที่ทำการสร้าง

<figure><img src="/files/xE9YGcfff8ntMUyocsEJ" alt=""><figcaption><p>กำหนดชื่อของ Database Instance</p></figcaption></figure>

### 3. เลือก MySQL เป็น SQL Engine และเลือก Version&#x20;

เลือก SQL Engine เป็น MySQL และเลือก Version ที่ต้องการหลังจากนั้นกดปุ่ม Next หรือกดที่ tab Machine Type เพื่อไปขั้นตอนถัดไป

<figure><img src="/files/9ntxdTmixWepMWSkmQgE" alt=""><figcaption><p>เลือก MySQL เป็น SQL Engine และเลือก Version</p></figcaption></figure>

### 4. เลือก Machine Type&#x20;

เลือก Machine Type หรือสเปคของ Database Instance หลังจากนั้นกดปุ่ม Next หรือกดที่ tab Database Storage เพื่อไปขั้นตอนถัดไป

<figure><img src="/files/whfcTvpUzx4IrseyRnTj" alt=""><figcaption><p>เลือก Machine Type</p></figcaption></figure>

### 5. เลือก Performance Type

เลือก Performance Type ของ Database Storage โดยปัจจุบันได้ให้บริการ 2 ชนิดดังต่อไปนี้

* DB\_Standard\_SSD
* DB\_Premium\_SSD

<figure><img src="/files/GdbFty4DrjThr8MrJd6j" alt=""><figcaption><p>เลือก Performance Type</p></figcaption></figure>

### 6. กำหนดขนาดของ Storage

กำหนดขนาดของ Database Storage โดยในช่วง Beta จะให้บริการขนาด Storage สูงสุดที่ 500 GB และสามารถเพิ่มขนาด Storage ได้ภายหลังจากสร้าง Database Instance แล้ว ([ขั้นตอนการเพิ่มขนาด Storage](/ncs-documents/database-as-a-service/sql-database/manage-sql-database-instance/online-extend-storage-size.md)) หลังจากนั้นกดปุ่ม Next หรือกดที่ tab Network เพื่อไปขั้นตอนถัดไป

<figure><img src="/files/InxYxM88QUddWpiMQtxs" alt=""><figcaption><p>กำหนดขนาดของ Storage</p></figcaption></figure>

### 7. เลือก Internal Network และ External Network&#x20;

เลือก VPC Network สำหรับสร้าง Internal IP ของ Database Instance โดย Internal IP จะต้องสร้างใหม่เท่านั้น สามารถเลือก IP Address เอง หรือให้ระบบเลือกให้ก็ได้เช่นกัน (VPC Network ต้องตั้งค่าให้ใช้งาน Security Group, DHCP และ RPF ถึงจะสามารถสร้าง Database Instance ไว้ที่ Network นั้นได้)&#x20;

<figure><img src="/files/4iecFUUUMQBap0hQUNtN" alt=""><figcaption><p>เลือก Internal Network</p></figcaption></figure>

Database Instance บังคับการใช้งาน External IP สำหรับการออกสู่ Internet เพื่อทำการติดตั้งและเข้าถึงเพื่อใช้งาน Database โดยไม่สามารถเลือก IP Address เองได้ (External IP สำหรับการใช้งาน Database Instance จะไม่แสดงที่หน้า External IP List และถูกคิดเงินรวมกับ Database Instance แล้ว) หลังจากนั้นกดปุ่ม Next หรือกดที่ tab Security เพื่อไปขั้นตอนถัดไป

<figure><img src="/files/ZMgOsUNpZmNzqJKE3SEx" alt=""><figcaption><p>เลือก External Network</p></figcaption></figure>

### 8. กำหนด CIDR

กำหนด Firewall ขั้นพื้นฐานด้วย CIDR สำหรับการเข้าถึง Database Instance ซึ่งสามารถกำหนดเป็น 0.0.0.0/0 เพื่อเข้าถึงได้อย่างอิสระ แต่ควรกำหนดค่าที่เหมาะสมเพื่อความปลอดภัยของ Database Instance โดยกำหนดได้สูงสุด 10 CIDR และสามารถแก้ไขได้ภายหลังจากสร้าง Database Instance แล้ว ([ขั้นตอนการแก้ไข CIDR](/ncs-documents/database-as-a-service/sql-database/manage-sql-database-instance/edit-allowed-cidr.md))

<figure><img src="/files/mHLQXIBD1T89VccaOcTl" alt=""><figcaption><p>กำหนด CIDR</p></figcaption></figure>

### 9. กำหนด Username และ Password ของ Database User&#x20;

กำหนด Username และ Password ของ Database User โดย Database User นี้จะมีสิทธิเข้าถึง Database Schema ที่ระบบสร้างมาให้ (DB-Default) และเข้าถึงได้จากทุก Host และสามารถสร้าง Database User เพิ่มได้ภายหลัง ([ขั้นตอนการสร้าง Database User](/ncs-documents/database-as-a-service/sql-database/manage-sql-database-user/create-database-user.md)) หลังจากนั้นกดปุ่ม Next หรือกดที่ tab Summary เพื่อไปขั้นตอนถัดไป

<figure><img src="/files/LbaX8QOC2Jd8YeExcKKY" alt=""><figcaption><p>กำหนด Username และ Password</p></figcaption></figure>

กรณีที่ต้องการเปลี่ยน Password ของ Database User หลังสร้าง Database Instance ไปแล้ว สามารถทำได้โดยคำสั่ง [Reset Password](/ncs-documents/database-as-a-service/sql-database/manage-sql-database-user/reset-password.md)&#x20;

กรณีที่สร้าง Database Schema เพิ่มในภายหลัง หากต้องการแก้ไขสิทธิของ Database User เพื่อเข้าถึง Database Schema เหล่านั้น สามารถทำได้โดยคำสั่ง [Edit Access](/ncs-documents/database-as-a-service/sql-database/manage-sql-database-user/edit-access.md)

{% hint style="info" %}
NCS ไม่ได้ให้บริการ Root User สำหรับ Database
{% endhint %}

### 10. ตรวจสอบการตั้งค่าของ Database Instance&#x20;

ตรวจสอบการตั้งค่าทั้งหมดของการ Create SQL Database Instance และสามารถย้อนกลับไปแก้ไขได้ หากพบข้อมูลที่ไม่ถูกต้อง

<figure><img src="/files/2S3fPwmiFXpCnz1SrfxC" alt=""><figcaption><p>ตรวจสอบการตั้งค่าของ Database Instance</p></figcaption></figure>

เมื่อตรวจสอบการตั้งค่าแล้ว ให้กดปุ่ม “CREATE” เพื่อเริ่มต้นการสร้าง Database Instance โดยที่ tab Summary นี้ จะไม่สามารถเข้ามาได้ หากขั้นตอนก่อนหน้ายังกรอกข้อมูลไม่สำเร็จ

<figure><img src="/files/q8FdNFrj4OJu8HhLKQnq" alt=""><figcaption><p>กดปุ่ม "CREATE" เพื่อทำการสั่งสร้าง</p></figcaption></figure>

### 11. Database Service Status เป็น Healthy และ Database Instance Status เป็น Active หลังจากทำคำสั่งสำเร็จ

หลังสั่งสร้าง Database Instance ระบบจะแสดงรายการ Database Instance ที่กำลังสร้าง&#x20;

<figure><img src="/files/YFcRfzvdp6exlXGfZV7s" alt=""><figcaption><p>แสดงรายการ Database Instance หลังสั่งสร้าง</p></figcaption></figure>

ให้รอจนกว่า Database Service Status เป็น Healthy และ Database Instance Status เป็น Active แสดงว่าคำสั่งสำเร็จ

<figure><img src="/files/aiaLjWk3x4cTJrRN4PPa" alt=""><figcaption><p>Database Instance ได้ถูกสั่งสร้างสำเร็จ</p></figcaption></figure>


---

# 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://docs-epc.gitbook.io/ncs-documents/database-as-a-service/sql-database/create-sql-database-instance/create-mysql-database-instance.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.
