Database import and export: migrate your data
Export database via mysqldump or phpMyAdmin, import to new server, handle large exports and compression.
Exporting and importing databases is essential for s, backups, and data transfers between servers. MySQL provides several methods from command-line to phpMyAdmin.
Export database
Via command line (mysqldump)
mysqldump -u username -p databasename > backup.sql
# Creates backup.sql file
Via phpMyAdmin
- Log in to phpMyAdmin (cPanel)
- Select your database
- Click Export tab
- Choose Quick or Custom export
- Select SQL format
- Click Go to download
Import database
Via command line
mysql -u username -p databasename < backup.sql
Via phpMyAdmin
- Create empty database on new server
- Log in to phpMyAdmin
- Select the empty database
- Click Import tab
- Upload your backup.sql file
- Click Go
Large database handling
Problem: phpMyAdmin upload limits often block large files (default 2-8MB).
Solution: Use command line for large exports:
mysqldump -u user -p --single-transaction mydb > backup.sql
# --single-transaction avoids locking
Compression options
Compress export to reduce file size:
mysqldump -u user -p mydb | gzip > backup.sql.gz
# Decompress before importing
gunzip backup.sql.gz
After importing, verify that tables exist and contain data: SHOW TABLES; and SELECT COUNT(*) FROM table;
Related: Database backups | Website
Need hosting for database-backed apps?
Run WordPress, CMS, PHP apps, and MySQL/MariaDB workloads on UnderHost hosting, VPS, or managed servers.





















