How to Import and Export MySQL Databases
Whether you're migrating to Faciotech, moving between servers, or managing development environments, knowing how to import and export databases is essential. This guide covers all the methods available.
Exporting a Database
Exporting creates a copy of your database that can be saved, transferred, or imported elsewhere.
Export via phpMyAdmin
- Log into cPanel and open phpMyAdmin
- Click on your database name in the left panel
- Click the Export tab
- Select export method:
- Quick - Exports entire database with default settings
- Custom - Choose specific tables and options
- Format should be SQL
- Click Go to download
Custom Export Options
When using Custom export, consider these options:
- Tables - Select specific tables or export all
- Add DROP TABLE - Useful when replacing existing database
- Add CREATE DATABASE - Include statement to create the database
- Compression - gzip or zip for large databases
- Character set - Use UTF-8 for compatibility
Export Specific Tables Only
- In phpMyAdmin, click your database
- Check the boxes next to tables you want to export
- At the bottom, select Export from the dropdown
- Click Go
Importing a Database
Before You Import
Prepare for the import:
- Create an empty database in cPanel if one doesn't exist
- Create a database user and assign it to the database
- Backup existing data if importing to a database with content
- Check file size - phpMyAdmin has upload limits (usually 50MB-500MB)
Import via phpMyAdmin
- Open phpMyAdmin in cPanel
- Select the target database from the left sidebar
- Click the Import tab
- Click Choose File and select your .sql file
- Settings to check:
- Character set: utf-8 (recommended)
- Format: SQL
- Click Go
Import Large Databases
For databases larger than the phpMyAdmin upload limit:
Method 1: Upload via File Manager
- Upload your .sql file to your hosting account using File Manager
- In phpMyAdmin, use the Import tab
- Instead of uploading, enter the server path to the file
Method 2: SSH Command Line
mysql -u username -p database_name < backup_file.sql
Method 3: Split the SQL File
Use a tool like BigDump or split the SQL file into smaller parts and import sequentially.
Migrating a Website Database
When moving a website to Faciotech:
- Export from old host - Use phpMyAdmin or command line
- Create database at Faciotech - Via cPanel MySQL Databases
- Import the database - Via phpMyAdmin
- Update configuration - Edit your application's config file with new database credentials
WordPress wp-config.php Example
define('DB_NAME', 'yourusername_dbname');
define('DB_USER', 'yourusername_dbuser');
define('DB_PASSWORD', 'your_secure_password');
define('DB_HOST', 'localhost');
Exporting from Different Platforms
From WordPress (via Plugin)
- Install the All-in-One WP Migration plugin
- Go to All-in-One WP Migration → Export
- Choose File to download a complete backup
From cPanel at Another Host
- Log into cPanel at your current host
- Go to phpMyAdmin
- Select database and click Export
- Choose Custom and enable Add DROP TABLE
- Download the SQL file
Common Import/Export Issues
| Issue | Solution |
|---|---|
| File too large to upload | Use SSH import or split the file |
| Timeout during import | Import in smaller batches |
| Character encoding errors | Ensure UTF-8 encoding on both export and import |
| Table already exists | Use DROP TABLE option or clear database first |
| Foreign key constraints | Disable foreign key checks during import |
| Unknown collation | Edit SQL file to use supported collation (utf8mb4_general_ci) |
Tips for Successful Transfers
- Always backup first - Before any import, backup existing data
- Check PHP/MySQL versions - Ensure compatibility between old and new servers
- Update URLs in database - For WordPress, use Search-Replace-DB tool
- Test after import - Verify your website works correctly
- Keep the original export - Save it until migration is fully verified
Need Assistance?
Migrating to Faciotech? Our support team can help with database imports. Submit a ticket with your SQL file and we'll assist you.