---
title: "How to Export or Import MySQL Database Table Data in WordPress"
url: "https://wpimportexport.com/how-to-export-or-import-mysql-database-table-data-with-wp-import-export/"
description: "Export WordPress MySQL tables to CSV, map columns, and update existing rows by a unique key. Step-by-step PRO tutorial with AI agent prompts."
type: post
published: 2026-06-15T09:02:23+00:00
modified: 2026-11-25T18:51:04+00:00
categories: ["Export Guides", "Import Guides", "WordPress Data Guides"]
tags: ["database table export", "database table import", "MySQL database table", "WordPress database export", "WordPress database import"]
docs_topics: ["Data, formats and functions"]
---

# How to Export or Import MySQL Database Table Data in WordPress

Plugins and custom code often keep their data in their own MySQL tables, outside posts and post meta, and WordPress has no screen to export them. In **Import Export by RockStarLab → Export**, choose **MySQL Database Table**, select the table and columns, and download a CSV. On another site, the matching Import workflow takes the file, lets you pick the destination table, map the columns and choose a unique field for matching records.

The example below uses a small custom locations table, then shows an update-only import and prompts for doing the same work through an AI agent. The MySQL Database Table workflow requires the **PRO Addon**. You work in the WordPress admin, without writing an SQL import query.

## When should you use a database table import or export?

Use this workflow when the data you need lives in a custom table: a directory of locations, an external catalogue, a lookup table, or records maintained by a custom application. It is also useful when you need selected table columns in a spreadsheet for review.

| Your task | Recommended approach |
| --- | --- |
| Download custom table records to a spreadsheet | MySQL Database Table export |
| Update selected columns in an existing custom table | MySQL Database Table import with a stable matching key |
| Move posts with ACF fields | The dedicated Posts import/export workflow |
| Import WooCommerce products, prices or variations | The dedicated WooCommerce workflow |
| Restore an entire database, including its structure | A database backup and restore tool |

A CSV contains rows and column headings. It does not preserve the original SQL table definition, indexes, foreign keys or triggers. Nor does copying one table automatically rebuild relationships with other WordPress records. For content-aware transfers, use the guides to [import ACF fields with posts](https://wpimportexport.com/how-to-import-posts-pages-custom-post-types-with-acf-pro-fields/) or [import WooCommerce products from CSV or Excel](https://wpimportexport.com/how-to-import-woocommerce-products-from-csv-or-excel/).

## Prepare the source and destination tables

Activate Import Export by RockStarLab and its PRO Addon on the relevant sites. Before importing, [create a database backup](https://wpimportexport.com/how-to-create-a-wordpress-website-backup-and-restore-it/). If the destination table belongs to another plugin, install and configure that plugin so it creates the correct table structure first.

The example uses `wp_tutorial_locations` with six columns. Your table prefix may differ from `wp_`; select the table that actually exists on each site.

| Column | Purpose | Example |
| --- | --- | --- |
| `id` | Local auto-increment primary key | 1 |
| `location_code` | Stable, unique business identifier | LOC-001 |
| `name` | Location name | Riverside Studio |
| `city` | City name | Tbilisi |
| `status` | Application status | active |
| `capacity` | Integer capacity | 24 |

The source contains three rows; the destination starts with an empty, compatible table. Here is the CSV structure:

```
id,location_code,name,city,status,capacity
1,LOC-001,Riverside Studio,Tbilisi,active,24
2,LOC-002,Garden Workshop,Batumi,active,16
3,LOC-003,Old Town Room,Kutaisi,inactive,0
```

For an existing table, check column types, maximum text lengths, required values and unique constraints before importing. A spreadsheet cannot tell you whether a particular value is valid for the application that owns the table.

## How to export a WordPress MySQL table to CSV

### 1. Choose MySQL Database Table and select the source

In the WordPress dashboard, go to **Import Export by RockStarLab → Export**. Select **MySQL Database Table** as the content type and continue to the table selection step.

Choose your source table from the Database Table dropdown. The information panel shows its row count and available columns. In this example, it shows three rows and six columns. Leave filters empty to export the whole example table. If you only need a subset, configure the available filters and review the resulting count before continuing.

![Selecting a custom MySQL table with three rows and six columns in WordPress](https://wpimportexport.com/wp-content/uploads/2026/10/mysql-01-table-1.webp)

_Select the source table and review its columns before exporting._

### 2. Select the columns to include

Use **Add all** to include every column, or add individual columns to the export structure. Keep `location_code` if the file will later be used to match existing locations. For a report, you might need only the code, name, city and capacity.

Exporting an ID is useful for reference, but it does not mean that ID should always be imported on another site. Local primary keys may already belong to different records there. For cross-site updates, match by a shared unique code and leave the destination ID unmapped.

![Six MySQL table columns selected for CSV export](https://wpimportexport.com/wp-content/uploads/2026/10/mysql-02-fields-1.webp)

_Export all six columns, or select only those needed for your spreadsheet._

### 3. Choose CSV and include column headings

Choose **CSV**, keep the comma delimiter, and enable **Include Header Row**. Enter a meaningful filename, such as `wordpress-custom-table-locations`, without an extension. The format step also offers XLSX, ODS, JSON and XML; CSV is convenient for the import example below.

Batch size controls how many records are processed together. The small example uses three. For larger tables, choose a batch size that suits your hosting resources; raising it does not guarantee a faster export.

![CSV export settings with a header row and custom filename](https://wpimportexport.com/wp-content/uploads/2026/10/mysql-03-format.webp)

_Include the header row so column names remain available during import._

### 4. Download and inspect the export

Click **Start Export** and wait for completion. Download the export file and open it in your spreadsheet application or text editor. Confirm the header names, row count and representative values before editing anything.

![Completed WordPress database table export with three rows](https://wpimportexport.com/wp-content/uploads/2026/10/mysql-04-export-complete.webp)

_Download the CSV when the export completes._

When opening CSV in a spreadsheet, import identifier columns as text if they contain leading zeros or values that resemble dates. Keep a copy of the original export. If you edit the file, save it as a UTF-8 CSV and preserve the delimiter and headings.

## How to import CSV rows into a WordPress database table

### 1. Select the import type and upload the file

On the destination site, open **Import Export by RockStarLab → Import** and select **MySQL Database Table**. Read the database warning and confirm the backup acknowledgement after creating your backup. Upload the CSV exported in the previous section.

### 2. Check the data preview

The preview should show three records and six columns. Check that `location_code` contains codes, `city` contains city names, and `capacity` contains numbers. The third capacity is `0`, which is a real value, not a missing value.

![CSV import preview showing three location records and six columns](https://wpimportexport.com/wp-content/uploads/2026/10/mysql-05-preview.webp)

_Check the preview before mapping: each value should appear under its correct heading._

If the whole row appears in one column, review the delimiter. If headings appear as a data row, check the header setting. Resolve parsing problems before continuing; mapping cannot reliably repair a file that has been read into the wrong columns.

### 3. Choose the destination table and map fields

Select the existing destination table. Its information panel should show the expected columns. Click **Auto Map** to match columns with the same names, then review each mapping. Map differently named headings manually.

![Auto Map matching CSV columns to a custom WordPress database table](https://wpimportexport.com/wp-content/uploads/2026/10/mysql-06-mapping.webp)

_Choose the destination table first, then review the six automatically mapped columns._

For this initial import into an empty table, all six columns are mapped. For an update to an already populated table, map only the matching key and the columns you intend to change. An unmapped column is different from a mapped column containing an empty value: do not add empty columns as placeholders for data you want to retain.

The interface also offers table creation. A data file is not a replacement for the original schema, so do not rely on CSV import to reproduce a plugin’s SQL types, keys and constraints. Using the table created by the owning plugin, or a compatible table prepared by your developer, is the appropriate starting point for this tutorial.

### 4. Set the matching and duplicate rules

Choose **Location Code** under **Check for Existing Items by Field**. For the initial transfer, select **Update** when a match is found and **Create** when no match is found.

![Database table import options matching by Location Code](https://wpimportexport.com/wp-content/uploads/2026/10/mysql-07-options.webp)

_Use a stable matching column and choose what happens to matching and unmatched rows._

| Import goal | If match found | If no match found |
| --- | --- | --- |
| Add new records and refresh existing ones | Update | Create |
| Change existing records only | Update | Skip |
| Add missing records without changing existing ones | Skip | Create |

The matching field must identify one record consistently. Do not use a name or city if multiple rows can share it. Ensure the key is populated and unique in both the file and the destination table. Choosing to create a new row when a match exists can produce duplicates or conflict with a unique database constraint.

### 5. Run the import and check the records

Start the import and review the created, updated, skipped and failed totals. The initial three-row file creates three records in the empty destination table.

![Completed database table import showing three created records and zero failures](https://wpimportexport.com/wp-content/uploads/2026/10/mysql-08-import-complete.webp)

_The initial import creates the three location records in the empty destination table._

Open the admin screen or frontend view that normally displays this table’s records. Check the location names, cities, statuses and capacities, including the zero value. If the table has no application interface, inspect representative rows in your database management tool. A completed job tells you that processing finished; checking the destination confirms that you selected the intended table and fields.

## Update only selected table columns from CSV

Suppose the two active locations need new capacities, while their names, cities and statuses should stay unchanged. Prepare a smaller file with the matching key and the capacity column:

```
location_code,capacity
LOC-001,30
LOC-002,18
LOC-999,10
```

Map only `location_code` and `capacity`. Select Location Code as the matching field, choose **Update** for matching rows, and choose **Skip** for unmatched rows. Leave `id`, `name`, `city` and `status` unmapped.

| Code | Result | Capacity |
| --- | --- | --- |
| LOC-001 | Existing row updated | 24 → 30 |
| LOC-002 | Existing row updated | 16 → 18 |
| LOC-003 | Not in the update file; unchanged | 0 |
| LOC-999 | No matching row; skipped | No new row created |

This approach keeps the table at three records and changes only the intended values. For WooCommerce inventory, use the product-specific [price and stock update workflow by SKU](https://wpimportexport.com/how-to-update-woocommerce-prices-stock-by-sku-csv/), which understands product fields.

## Export or import database table data with an AI agent

Import Export by RockStarLab gives AI agents its exports, imports and Content Sync as abilities. Through the WordPress MCP Adapter, WordPress itself offers an agent only read-only abilities for site, user and environment information, so without the plugin the agent cannot do the steps above (to connect an agent, see [WordPress Abilities API and AI agent setup guide](https://wpimportexport.com/how-to-use-the-wordpress-abilities-api-with-ai-agents-exports-imports-content-sync-and-backups/)). With it, one request is enough:

Start by asking the agent to discover available abilities and execute `rsl-ie/get-capabilities` with `{}`. Availability depends on the installed plugins and the authenticated user’s permissions. Have the agent inspect the selected table and preview the data before starting an import.

### Prompt 1: inspect the available table workflow

```
On the source WordPress site, discover the Import Export by RockStarLab abilities.
Read the input schema for rsl-ie/get-capabilities and execute it with {}.
Check whether PRO database_table export is available.
Use the available discovery/schema abilities to inspect wp_tutorial_locations.
Report the columns and prepare a preview of id, location_code, name, city,
status and capacity. Do not modify records or start an import.
```

### Prompt 2: export the table to CSV

```
Export wp_tutorial_locations from the source site to CSV using the plugin's
PRO export abilities. Read their current input schemas first.
Use export_type database_table and select these fields:
id, location_code, name, city, status, capacity.
Set options.table_name to wp_tutorial_locations and include a CSV header row.
Preview the rows, then start the export. Monitor the returned job until it
finishes and retrieve the exported file with rsl-ie/file-get.
Give me the download link and the exported row count.
```

The export workflow uses `rsl-ie-pro/export-preview` and `rsl-ie-pro/export-start`, followed by job monitoring and file retrieval. The agent should use the returned file reference or download link, rather than inventing a filesystem path.

### Prompt 3: update capacities without creating records

```
On the destination WordPress site, prepare an update to wp_tutorial_locations
from this CSV:
location_code,capacity
LOC-001,30
LOC-002,18
LOC-999,10

Read the current upload and PRO import ability schemas. Upload the CSV and
use its returned file_id. Set import_type to database_table.
Map only location_code to location_code and capacity to capacity.
Set options.table_name to wp_tutorial_locations,
unique_field to location_code, duplicate_handling to update,
if_not_exists to skip, and has_header to true.

Show me the parsed rows, mapping and matching rules, and confirm that a
current destination database backup exists. Wait for my approval before
starting the import. After approval, run the import, monitor its job,
and report updated/successful, skipped and failed totals.
Do not map IDs or modify names, cities or statuses.
```

For a transfer between two sites, the export file must be made available to the destination import. A file identifier returned by the source site is not automatically a destination upload identifier. Keep the source and destination connections explicit in your prompts, and use the destination’s upload workflow before starting its import.

## Common database table import problems

| Symptom | What to check |
| --- | --- |
| MySQL Database Table is unavailable | Check that the PRO Addon is active and the account has the required permissions. |
| The expected table is missing | Check the selected site, actual table prefix and whether the owning plugin has created its table. Restricted/internal tables may not be exposed through AI abilities. |
| Auto Map leaves fields unmapped | Compare file headings with destination column names and map renamed fields manually. |
| Rows are skipped unexpectedly | Review the unique matching field and the rules for matching and unmatched rows. |
| A row fails to insert | Inspect the job error and check required values, data types, lengths and unique constraints. |
| Existing values are replaced with blanks | Review mapped empty columns. Remove mappings for columns that should not change. |
| The application still shows old data | Confirm the destination records first, then check the application’s cache and whether it reads the selected table. |

## Frequently asked questions

### Can I export a WordPress MySQL table to CSV without phpMyAdmin?

Yes. With the PRO Addon active, choose MySQL Database Table in Import Export by RockStarLab, select the table and columns, choose CSV, and download the completed export from WordPress.

### Can I export database table data to Excel?

The export format step offers XLSX as well as CSV, ODS, JSON and XML. Choose XLSX for an Excel workbook, or CSV for a plain-text file that spreadsheet applications can open.

### Does importing a CSV restore the original SQL table structure?

No. CSV contains column headings and row values, not the original SQL schema, indexes or constraints. Prepare a compatible destination table. Use a database backup tool when you need a full database restore.

### How do I update existing rows without creating new ones?

Choose a stable unique matching column, set matching rows to Update, and set unmatched rows to Skip. Map only the matching key and the columns you want to change.

### Should I match records by ID when moving data between sites?

Only when you know those IDs identify the same records on both sites. For independent tables, use a shared unique business key such as location_code and leave the destination auto-increment ID unmapped.

### Can I import only two columns from a larger table?

Yes. For a partial update, provide the matching key and the column to change, and map only those fields. The example updates capacity by location_code while leaving names, cities and statuses unchanged.

### Can an AI agent export and import custom table records?

Yes, when the site exposes the required PRO database-table abilities through MCP and the authenticated account has permission. Ask the agent to discover the current schemas, preview the data, use the returned file and job references, and report the completed result.

### Is a database table export a complete WordPress backup?

No. A selected-table data export does not include all database tables, WordPress files, uploads, themes or plugins. Create a separate full backup before database imports.

For related workflows, browse the [WordPress import and export tutorials](https://wpimportexport.com/import-export-video-tutorials-for-wordpress/#written-guides).
