> For the complete documentation index, see [llms.txt](https://mango-5m.gitbook.io/mango5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mango-5m.gitbook.io/mango5m-docs/resources/mango-mdt/getting-started/first-admin-setup.md).

# First Admin Setup

Create the first admin user, find your license identifier, and understand what admin access grants.

MDT access is controlled by rows in the `mdt_users` table — a framework identifier mapped to a department and rank grade. Your first admin is one SQL insert.

{% hint style="success" %}
**This is a one-time bootstrap, not a routine.** The SQL insert exists only because a fresh install has zero users — someone has to be first. Once your admin can log in, **everything else happens in-game**: bosses and admins hire officers from the Departments page (which creates their MDT user *and* sets their framework job in one click), and permissions are edited live on the Permissions tab. You should never need SQL for user management again.
{% endhint %}

{% stepper %}
{% step %}

### Find your identifier

The MDT keys users on your framework's **persistent character id** — a different value per framework:

{% tabs %}
{% tab title="ESX Legacy" %}
Your **Rockstar license** identifier — `license:2a4f8c1d9b3e5a7f...` (40 hex characters). Find it via:

* **txAdmin** → Players → your player → the `license:` identifier.
* **Database** — your row in ESX's `users` table (`identifier` column).
* **Server console** — identifiers print in the connection log when you join.
  {% endtab %}

{% tab title="QBCore / Qbox" %}
Your character's **citizenid** — a short code like `ABCD1234`. Find it via:

* `/id` or your server's ID command (many servers show citizenid).
* **Database** — your row in the `players` table (`citizenid` column).
* Your multicharacter UI often shows it on the character card.

{% hint style="warning" %}
Use the **citizenid**, not the `license:` value — the license identifies your whole account; the citizenid identifies the one character who is the officer.
{% endhint %}
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Insert your admin row

Replace the identifier and run:

{% tabs %}
{% tab title="ESX Legacy" %}

```sql
INSERT INTO `mdt_users` (`identifier`, `department_id`, `rank_grade`, `callsign`, `badge_number`)
SELECT 'license:PUT_YOURS_HERE', d.id, 4, '1-ADAM-1', '001'
FROM `mdt_departments` d
WHERE d.name = 'police';
```

{% endtab %}

{% tab title="QBCore / Qbox" %}

```sql
INSERT INTO `mdt_users` (`identifier`, `department_id`, `rank_grade`, `callsign`, `badge_number`)
SELECT 'PUT_YOUR_CITIZENID_HERE', d.id, 4, '1-ADAM-1', '001'
FROM `mdt_departments` d
WHERE d.name = 'police';
```

{% endtab %}
{% endtabs %}

Two things must line up:

* **`d.name = 'police'`** — the department short code. It must equal your **framework job name** (ESX Legacy, QBCore, and Qbox all name their default police job `police`). If your job is named differently, see [Departments](/mango5m-docs/resources/mango-mdt/configuration/departments.md).
* **`rank_grade = 4`** — must match a `grade` defined under `Config.Ranks.police` in `config/ranks.lua`. In the shipped config, **grade 4 is the Chief rank** (`isBoss = true`) and holds `mdt.access`, `mdt.admin`, and `mdt.manage_users`.

{% hint style="info" %}
Your framework job grade and MDT rank grade are the same number space — the MDT reads rank **names** live from your framework (ESX's `job_grades` table; QBCore/Qbox's shared jobs config), so grade 4 in the MDT displays whatever your framework's grade 4 is labelled.
{% endhint %}
{% endstep %}

{% step %}

### Log in

`/mdt` in-game (or press `F6`). You'll land on the dashboard with full access.
{% endstep %}
{% endstepper %}

## What `mdt.admin` means

`mdt.admin` implies **every** permission — every module, every department, every action. From here you can do everything else in-game instead of SQL:

* **Departments → Permissions tab** — grant/revoke permissions per rank or per user, live, no restart.
* **Departments → Hire** — department bosses (the `isBoss` rank) and admins can hire online players straight into a department: it assigns the framework job at the lowest grade **and** creates their MDT user row in one step.

{% hint style="warning" %}
Grant `mdt.admin` sparingly — it bypasses department scoping and every permission check. Day-to-day department management only needs the boss rank's own powers.
{% endhint %}
