Software⏱️ 3 min read📅 2026-06-11

How to Fix error 1839 Error – Import MySQL data failed with error 1839

MySQL data import error 1839 fix

Quick Answer: Set @@GLOBAL.GTID_PURGED to OFF and ensure @@GLOBAL.GTID_MODE is set to ON.

The error 'Import MySQL data failed with error 1839' affects users who are trying to import MySQL data into their databases, particularly those with GTID (Global Transaction Identifiers) configured. This error occurs when the imported data is not compatible with the GTID settings of the target database.

This error can be frustrating for database administrators as it prevents them from successfully importing critical data into their systems. However, by following the steps outlined in this guide, you should be able to resolve the issue and import your MySQL data without any further complications.

⚠️ Common Causes

  • The primary reason why this error occurs is that the @@GLOBAL.GTID_PURGED variable is being set to a value that is incompatible with the GTID mode of the target database. When importing data from a master server, it's essential to ensure that the GTID settings of both servers match, including the value of @@GLOBAL.GTID_PURGED.
  • An alternative reason for this error could be that the GTID mode of the target database is set to 'OFF', which prevents the import process from proceeding. This might occur if the GTID configuration was not properly enabled on the target server.

🚀 How to Resolve This Issue

Enabling GTID Mode and Setting @@GLOBAL.GTID_PURGED

  1. Step 1: Step 1: Enable GTID mode on the target database by running the following command: `mysql -u [username] -p[password] [database_name] -e 'SET GLOBAL gtid_mode = ON; SET GLOBAL gtid_concentrated_timestamps = ON;'`
  2. Step 2: Step 2: Set the value of @@GLOBAL.GTID_PURGED to match the GTID settings of the master server. You can do this by running the following command: `mysql -u [username] -p[password] [database_name] -e 'SET GLOBAL gtid_PURGED = [master_server_gtid_purged_value];'`
  3. Step 3: Step 3: Verify that GTID mode is enabled and the value of @@GLOBAL.GTID_PURGED has been set correctly by running the following command: `mysql -u [username] -p[password] [database_name] -e 'SHOW GLOBAL VARIABLES LIKE 'gtid_mode';'`

Disabling GTID Purged and Importing

  1. Step 1: Step 1: Disable the GTID purge by setting the value of @@GLOBAL.GTID_PURGED to 'OFF': `mysql -u [username] -p[password] [database_name] -e 'SET GLOBAL gtid_PURGED = OFF;'`
  2. Step 2: Step 2: Import the data without specifying the GTID purge value. You can do this by running the following command: `mysql -u [username] -p[password] [database_name] < [data_backup_file];`

✨ Wrapping Up

By following these steps, you should be able to resolve the 'Import MySQL data failed with error 1839' issue and import your MySQL data successfully. Remember to verify that GTID mode is enabled and the value of @@GLOBAL.GTID_PURGED has been set correctly before proceeding.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions