> ## Documentation Index
> Fetch the complete documentation index at: https://speedypage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Import and export MySQL databases

> How to import and export databases using phpMyAdmin in cPanel, and fix the "Access denied CREATE DATABASE" error.

You can import and export MySQL databases through phpMyAdmin in cPanel. This is useful when migrating a site, restoring a backup, or moving data between environments.

## Import a database

<Steps>
  <Step title="Open phpMyAdmin">
    Log in to cPanel through your [client area](https://my.speedypage.com) or at `yourdomain.com/cpanel`. Go to **Databases** and click **phpMyAdmin**.
  </Step>

  <Step title="Select the target database">
    Click the database you want to import into from the left sidebar. If you haven't created one yet, go back to cPanel and use **MySQL Databases** to create it first.
  </Step>

  <Step title="Import the file">
    Click the **Import** tab at the top, then click **Browse** to select your `.sql` file. Leave the default settings and click **Go**.
  </Step>
</Steps>

You'll see a success message once the import finishes.

<Note>
  phpMyAdmin has a file size limit for imports. For larger databases, import via SSH instead:

  ```bash theme={null}
  mysql -u dbuser -p dbname < backup.sql
  ```
</Note>

## Export a database

<Steps>
  <Step title="Open phpMyAdmin">
    In cPanel, go to **Databases** and click **phpMyAdmin**.
  </Step>

  <Step title="Select the database">
    Click the database you want to export from the left sidebar.
  </Step>

  <Step title="Export">
    Click the **Export** tab. For most cases, the **Quick** method with **SQL** format works fine. Click **Go** to download the `.sql` file.
  </Step>
</Steps>

<Tip>
  Use the **Custom** export method if you need to export specific tables or adjust options like adding `DROP TABLE` statements.
</Tip>

## Fix "Access denied CREATE DATABASE" errors

This error happens when your `.sql` file contains a `CREATE DATABASE` statement. On shared hosting, your cPanel user doesn't have permission to create databases through SQL — you create them through cPanel instead.

To fix it:

1. Open the `.sql` file in a text editor.
2. Find and delete the `CREATE DATABASE` line (usually near the top). Also remove any `USE database_name;` line if present.
3. Save the file and import it again, making sure you've selected the correct database in phpMyAdmin first.
