# Enable Root User

เปิดการใช้งาน Root User ของ Database นั้น โดยระบบจะสุ่มรหัสผ่านมาให้ ซึ่งรหัสผ่านที่ได้จะเป็น Unique Password  และไม่มีการเก็บรหัสผ่านดังกล่าวใน NCS เพื่อความปลอดภัย&#x20;

{% hint style="info" %}
เมื่อเปิดการใช้าน Root User แล้ว จะไม่สามารถปิดการใช้งานได้อีก
{% endhint %}

## Prerequisite

* มี Database Instance ใน Project ([ขั้นตอนการสร้าง SQL Database Instance](https://docs-epc.gitbook.io/ncs-documents/database-as-a-service/sql-database/create-sql-database-instance))
* Database Instance ยังไม่ได้ Enable Root User

## Instructions

### 1. เข้าสู่หน้า Database Instances&#x20;

เลือกรายการ “Database Instances” ที่ Sidebar จากเมนู SQL Database

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2FOrNLtytETeDyKEVzIZhV%2Fimage.png?alt=media&#x26;token=0775cd9e-93a6-4f31-83a1-db89a0273a8b" alt=""><figcaption><p>เข้าหน้า Database Instances</p></figcaption></figure>

### 2. เข้าสู่หน้า Database Instance Detail&#x20;

เข้าไปที่หน้า Database Instance Detail ของ Database Instance ที่ต้องการทำคำสั่ง&#x20;

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2F9d78qnaEy7VfZdgDXhWN%2Fimage.png?alt=media&#x26;token=3035c986-ab7c-442e-b69e-c1dcecb28c58" alt=""><figcaption><p>คลิกที่ชื่อของ Database Instance เพื่อเข้าหน้า Database Instance Detail</p></figcaption></figure>

### 3. เลือกคำสั่ง Enable Root User

เลือกคำสั่ง Enable Root User ได้จากการ์ด Basic Detail ที่ column: Root User

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2FKY43Qfb128BBRdGNyW9H%2Fimage.png?alt=media&#x26;token=aca8083a-ff92-40f8-805d-cb7a9b7dad46" alt=""><figcaption><p>เลือกคำสั่ง Enable Root User</p></figcaption></figure>

### 4. ยืนยันคำสั่ง Enable Root User

กดปุ่ม "ENABLE" เพื่อยืนยันคำสั่ง

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2FUaGsl8vDu26GvsuupqkI%2Fimage.png?alt=media&#x26;token=64ccb46d-5a1a-4f4d-ba42-db8823887a78" alt=""><figcaption><p>กดปุ่ม ENABLE</p></figcaption></figure>

### 5. Root User จะสามารถใช้งานได้ หลังจากทำคำสั่งสำเร็จ&#x20;

ระบบจะแสดงผล Username และ Password&#x20;

* Username เป็น root เสมอ
* Password จะแสดงผลครั้งเดียว หลัง Enable Root User สำเร็จเท่านั้น หากลืมหรือต้องการเปลี่ยนแปลง Password สามารถทำได้ด้วยคำสั่ง [reset-root-user-password](https://docs-epc.gitbook.io/ncs-documents/database-as-a-service/sql-database/manage-sql-database-root-user/reset-root-user-password "mention")

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2Fr7qtMngeg6kcnn791Z97%2Fimage.png?alt=media&#x26;token=151b6891-0074-402a-ae6b-1dec62e7ed5a" alt=""><figcaption><p>ตัวอย่าง Username และ Password</p></figcaption></figure>

{% hint style="warning" %}
Root User มีสิทธิ์การเข้าถึงสูงสุด การจัดการและการเก็บรักษา Password จึงควรทำด้วยความระมัดระวัง
{% endhint %}

Root User เป็น Enabled ที่หน้า Database Instance Detail แสดง Username: root และ คำสั่ง Reset Password

<figure><img src="https://1352697161-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq2BYmWTMiaonrEL8QBP2%2Fuploads%2F1vprHJgyJJLMWtf0727i%2Fimage.png?alt=media&#x26;token=bb3ee806-74a9-4ea1-96e7-0a5741d26fe3" alt=""><figcaption><p>หลัง Enable Root User สำเร็จ</p></figcaption></figure>
