Why character sets break migrations
MySQL stores text in a character set. Modern applications use utf8mb4, which covers every Unicode character, including Devanagari and other Indian scripts as well as emoji. MySQL's older utf8 (an alias for utf8mb3) cannot store characters that need four bytes, such as emoji, and the much older latin1 default cannot store Indian scripts correctly at all.
Corruption usually happens in one of two ways:
- Double encoding: the dump is written or read with the wrong client character set, so UTF-8 bytes are converted again. The result is the familiar
Ãorà¤gibberish. - Truncation: four-byte characters are imported into a
utf8mb3column and replaced or cut off.
Both are prevented by being explicit about utf8mb4 when you export, when you create the database and when you import.

Step 1: Check the source database
SELECT default_character_set_name, default_collation_name
FROM information_schema.SCHEMATA WHERE schema_name = 'shopdb';
SELECT table_name, table_collation
FROM information_schema.TABLES WHERE table_schema = 'shopdb';
If tables already use utf8mb4, the steps below keep them that way. If some use latin1 but contain UTF-8 text (common on very old sites), fix them in a planned conversion after the move rather than mid-migration.
Step 2: Export and import a MySQL database, part one: mysqldump
mysqldump -u root -p \
--single-transaction --quick \
--default-character-set=utf8mb4 \
--routines --triggers --events \
shopdb | gzip > shopdb-2026-11-23.sql.gz
| Option | Why use it |
|---|---|
--single-transaction | Consistent snapshot of InnoDB tables without locking the live site |
--quick | Streams rows instead of loading whole tables into memory |
--default-character-set=utf8mb4 | Writes text without re-encoding it |
--routines --triggers --events | Includes stored procedures, triggers and scheduled events, which are easy to forget |
| gzip | Text dumps compress very well, often to a fraction of the original size |
The full option list is in MySQL's mysqldump reference. Use an account with enough privileges; on Ubuntu, sudo mysqldump works through socket authentication, as explained in our MySQL root password guide.
Step 3: Create the database and import
On the destination server, create an empty database with the right defaults. Use utf8mb4_0900_ai_ci on MySQL 8, or utf8mb4_unicode_ci on MariaDB and older MySQL:
CREATE DATABASE shopdb CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
CREATE USER 'shopapp'@'localhost' IDENTIFIED BY 'a-long-random-password';
GRANT ALL PRIVILEGES ON shopdb.* TO 'shopapp'@'localhost';
Then import, with a progress bar if pv is installed:
pv shopdb-2026-11-23.sql.gz | gunzip | mysql -u root -p --default-character-set=utf8mb4 shopdb
Without pv, use gunzip < shopdb-2026-11-23.sql.gz | mysql ....
Copying straight from one server to another
For a server move, you can skip the intermediate file and stream the database over SSH:
mysqldump --single-transaction --quick --default-character-set=utf8mb4 \
--routines --triggers --events shopdb \
| gzip | ssh user@new-server "gunzip | mysql --default-character-set=utf8mb4 shopdb"
This works well for databases of a few gigabytes. For larger ones, tools that dump and load tables in parallel (such as mydumper/myloader) or physical backups are faster. For a whole-site move with minimal downtime, follow our zero-downtime migration checklist.
Step 4: Verify the import
- Compare row counts for important tables on both servers:
SELECT COUNT(*) FROM orders; - Check text in a non-English record, for example a product name in Hindi, in both the database and the website.
- Confirm the connection character set in your application: WordPress uses
DB_CHARSET=utf8mb4inwp-config.php; Laravel setscharsetinconfig/database.php. - Test logins, checkout and search before switching DNS.
Keep the dump file for a few days after the move, stored somewhere other than the new server. If a problem appears later, it is your quickest way to compare old and new data.
Common import errors and fixes
| Error or symptom | Cause | Fix |
|---|---|---|
Gibberish such as न in Indian text | Character set mismatch, causing double encoding | Re-export and import with --default-character-set=utf8mb4 on both sides |
Unknown collation utf8mb4_0900_ai_ci | Dump from MySQL 8 imported into MariaDB or MySQL 5.7 | Replace it with utf8mb4_unicode_ci in the dump before importing |
Access denied; you need SUPER privilege | DEFINER clauses for users that do not exist on the new server | Create those users, or edit the DEFINER clauses |
MySQL server has gone away | Very large rows exceed max_allowed_packet | Raise max_allowed_packet on the server and client |
| Import is very slow | Slow disk or a small buffer pool | Import on NVMe storage; see optimising an Ubuntu VPS |
Why developers choose SkyRain Cloud VPS
Database moves are quicker on fast storage. SkyRain Cloud Intel VPS plans include:
- KVM virtualization. Your own kernel and allocated vCores, so you can tune the system the way this guide describes.
- Intel Xeon Platinum 8269CY hosts. Server-class Cascade Lake CPUs with DDR4 ECC memory.
- NVMe SSD storage on every plan, which keeps I/O wait low for databases and builds.
- Full root access to install and configure whatever your stack needs.
- Unmetered 1 Gbps port in India, close to your users.
- Simple billing and real support. Monthly billing in rupees with UPI, plus 24/7 tickets, WhatsApp and Discord.
Frequently Asked Questions
How do I export a MySQL database from the command line?
How do I import a .sql.gz file into MySQL?
Why is my Hindi text showing as strange characters after import?
What is the difference between utf8 and utf8mb4 in MySQL?
Will mysqldump lock my live website?
How do I move a MySQL database directly to another server?
Conclusion
To export and import a MySQL database safely, be explicit about utf8mb4 at every step: when dumping, when creating the new database and when importing. Use --single-transaction to avoid locking a live site, include routines, triggers and events, compress the dump, and verify both row counts and real non-English text afterwards. Do that and your Hindi product names and customer emoji arrive exactly as they left.
For a fast home for your database in India, see our Intel VPS plans.
SkyRain Cloud Intel Xeon VPS Plans
KVM VPS on Intel Xeon Platinum 8269CY (up to 3.80 GHz Turbo) with DDR4 ECC memory, NVMe SSD, full root access and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — Intel | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Business websites, small apps, scheduled jobs and bots | Order |
| VPS 2 — Intel | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,169/month | Business software, mid-size databases, several sites on one server | Check stock |
| VPS 3 — Intel | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,249/month | ERP/CRM stacks, heavier databases, multiple production apps | Check stock |
| VPS 4 — Intel | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,299/month | High-memory workloads and consolidated production servers | Check stock |
Prices are monthly in INR as listed on the SkyRain Cloud store (verified 2026-11-23). Live stock and final price are shown at checkout.