# Database Import and Export

## Overview

In this guide, you will learn how to import and export a file for the following supported Database protocols:

* [MySQL](#sql-import-and-export)
* [SQL Server](#sql-server-import-and-export)
* [PostgreSQL](#postgresql-import-and-export)

## SQL Import and Export

### SQL Import <a href="#import" id="import"></a>

Import data from a file on your machine into the MySQL connection.

To import data from a csv file, is the `LOAD DATA` MySQL command:

Copy

```
LOAD DATA LOCAL INFILE "input.csv" INTO TABLE <table> FIELDS
  TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
```

In the example above, "\<table>" should be replaced with the SQL table to import data into. The other parts of the command are required for CSV-formatted files. If your uploaded file uses different termination characters update the query accordingly.

After running the query, Keeper Connection Manager will prompt you to supply the data file. To upload the file, simply drag and drop it from your machine onto the browser window.

The file uploaded does not have to have the same name given in the query

### SQL Export <a href="#export" id="export"></a>

Data from the connected MySQL database can be exported to a file on your machine. To do this, use the following query:

Copy

```
 SELECT <query> INTO LOCAL OUTFILE "<name>.csv"
```

The result of the given \<query> will be put into a CSV file with the given name and downloaded from the browser to your machine.

## SQL Server Import and Export

### SQL Server Import <a href="#import" id="import"></a>

Import data from a file on your machine into the SQL Server connection.

To import data from a csv file, is the `COPY` command:

Copy

```
BULK INSERT <table> FROM LOCAL FILE
```

In the example above, "\<table>" should be replaced with the SQL table to import data into. The other parts of the command are required for CSV-formatted files. If your uploaded file uses different termination characters update the query accordingly.

After running the query, Keeper Connection Manager will prompt you to supply the data file. To upload the file, simply drag and drop it from your machine onto the browser window.

The file uploaded does not have to have the same name given in the query

### SQL Server Export <a href="#export" id="export"></a>

Data from the connected PostgreSQL database can be exported to a file on your machine. To do this, use the following query:

Copy

```
 SELECT <query> INTO LOCAL OUTFILE "<name>.csv"
```

The result of the given \<query> will be put into a CSV file with the given name and downloaded from the browser to your machine.

## PostgreSQL Import and Export

### PostgreSQL Import <a href="#import" id="import"></a>

Import data from a file on your machine into the PostgreSQL connection.

To import data from a csv file, is the `COPY` command:

Copy

```
 \COPY <table> FROM "input.csv" With CSV
```

In the example above, "\<table>" should be replaced with the SQL table to import data into. The other parts of the command are required for CSV-formatted files. If your uploaded file uses different termination characters update the query accordingly.

After running the query, Keeper Connection Manager will prompt you to supply the data file. To upload the file, simply drag and drop it from your machine onto the browser window.

The file uploaded does not have to have the same name given in the query

### PostgreSQL Export <a href="#export" id="export"></a>

Data from the connected PostgreSQL database can be exported to a file on your machine. To do this, use the following query:

Copy

```
 \COPY (<query>) TO "<name>.csv" With CSV HEADER
```

The result of the given \<query> will be put into a CSV file with the given name and downloaded from the browser to your machine.


---

# 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.keeper.io/keeperpam/privileged-access-manager/references/database-import-and-export.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.
