> For the complete documentation index, see [llms.txt](https://help.glpi-project.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.glpi-project.org/tutorials/my-instance/export_database.md).

# Export local database and files

## Recommended method : via CLI

### Database

Once connected in CLI on your server hosting your database, run the following commands:

```
mysqldump -u myuser -p  myglpibase > mydump.sql
tar -czf mydump.sql.tar.gz mydump.sql
```

### Files&#x20;

Perform an archive of the files folder using the command below (keeping the exclusion of the mentioned folders):&#x20;

<pre data-overflow="wrap"><code>tar --exclude="_cache" --exclude="_cron" --exclude="_dumps" --exclude="_graphs" --exclude="_lock" --exclude="_log" --exclude="_rss" --exclude="_sessions" --exclude="_tmp" --exclude="_uploads" -zcvf files.tar.gz <a data-footnote-ref href="#user-content-fn-1">files/</a> 
</code></pre>

If you use a method other than the one mentioned, we invite you to exclude from compression the folders cited below, from the files folders:&#x20;

* **`_cache`**&#x20;
* **`_cron`**&#x20;
* **`_dumps`**&#x20;
* **`_graphs`**&#x20;
* **`_lock`**&#x20;
* **`_log`**&#x20;
* **`_rss`**&#x20;
* **`_sessions`**&#x20;
* **`_tmp`**&#x20;
* **`_uploads`**

***

## Alternative method: graphical tool (HeidiSQL)

If you are not comfortable with command lines, you can use a graphical tool like HeidiSQL which we recommend here to build your dump.

Follow all the steps in this guide to make sure the dump is complete and well built!

* Connect HediSQL to your database
* Once connected to your database, right click on it.
* Click on **`Export database to SQL`** (graphical tool)

![Alt text](/files/XcfT4tyav8lHphxm06sy)

In the export tool, make sure that **only** your database is selected.

* Check **`Create in Table(s)`**
* Choose **`INSERT`** in Data
* Choose **`.sql file compressed in ZIP`** in the Destination
* Name your file
* Click on **`Export`**

![Alt text](/files/c5dQkcu0yNeg4VNjUonn)

## Not recommended

* Export via **PHPMYADMIN** : most of the time, dumps are incomplete, with syntax errors, change undesired variable, etc.
* **Maintenance menu of GLPI** : Legacy feature, dumps export is incomplete
* **Powershell** : most of the time, dumps is done with non-standard encoding

[^1]: modify the path to your folder if necessary


---

# 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://help.glpi-project.org/tutorials/my-instance/export_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.
