> For the complete documentation index, see [llms.txt](https://theobsidianstudio-1.gitbook.io/theobsidianstudio-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://theobsidianstudio-1.gitbook.io/theobsidianstudio-docs/helpful/basic-server-knowledge/how-to-import-sql-to-database.md).

# How to import SQL to database?

Certain resources include `.sql` files that must be added to your database before the script can function correctly. These files usually create required tables, insert default data, or register important entries used by the resource.

{% hint style="info" icon="gears" %}
Installation Process
{% endhint %}

This guide uses [HeidiSQL](https://www.heidisql.com/) as an example, but the same process can also be done with [phpMyAdmin](https://www.phpmyadmin.net/) or any similar database manager.

{% hint style="info" icon="play" %}
Before You Start
{% endhint %}

Avoid importing the same SQL file more than once. If you're not sure whether it has already been added, verify whether the related tables already exist inside your database.

{% stepper %}
{% step %}

### Connect to Your Database&#xD;

Open HeidiSQL and select your saved MySQL connection, then connect to your server database.
{% endstep %}

{% step %}

### Locate Your Server Database&#xD;

From the left panel, choose the database used by your server. Common database names include `fivem`, `es_extended`, or any custom database configured in your server.
{% endstep %}

{% step %}

### Open the SQL Editor&#xD;

After selecting the database, click the **Query** tab from the top toolbar. This opens an SQL editor where commands can be executed manually.
{% endstep %}

{% step %}

### Load the SQL Content&#xD;

Open the provided `.sql` file using any text editor, copy its full contents, then paste it into the SQL editor.

If the resource includes multiple SQL files, import each file separately in the same way.
{% endstep %}

{% step %}

### Execute the Query&#xD;

Run the SQL using the **Execute** button or press **F9**. If successful, the database tool will confirm that the query has completed without errors.
{% endstep %}

{% step %}

### Final Check&#xD;

After execution, refresh your database tables to confirm the new entries were created successfully.
{% endstep %}
{% endstepper %}

{% hint style="info" icon="lightbulb" %}
**Extra Note**
{% endhint %}

Some scripts may include separate SQL files for:

* items
* jobs
* permissions
* additional configuration data

Make sure none of them are skipped during installation.


---

# 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, and the optional `goal` query parameter:

```
GET https://theobsidianstudio-1.gitbook.io/theobsidianstudio-docs/helpful/basic-server-knowledge/how-to-import-sql-to-database.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
