mysqldump: Couldn’t execute ‘SELECT @@GTID_MODE’: Unknown system variable ‘GTID_MODE’ (1193)

If you are using the MySQL 5.6 version of mysqldump on an older MySQL database, you might get the error message.

mysqldump: Couldn't execute 'SELECT @@GTID_MODE': Unknown system variable 'GTID_MODE' (1193)

This error is in part due to the introduction of Global Transaction Identifiers (GTIDs) in MySQL 5.6. GTIDs make it simple to track and compare replication across a master-slave topology.

mysqldump tries to query this system variable, which doesn’t exist in earlier versions, and then fails. The solution is to add –set-gtid-purged=OFF in the mysqldump command. It should look something like

mysqldump -h dbHost -u dbuser dbName --set-gtid-purged=OFF

7 Comments

  1. Siros says:

    Thank you so much !!

    is there a place where can is set this as default ?

  2. Paul says:

    Brilliant, thanks.

  3. Lx says:

    Thanks, precious tip!

  4. Gerson Jr says:

    Thank you!

  5. Sysadmin says:

    It works! Now I can make a dump from 5.5.13 mysql server using mysqldump from 5.6.10 version.

    Thank you.

    BTW, I invented another method for dumping 5.5 databases from a system with 5.6 version:

    cat /opt/mysql-5.0.95/mysqldump_5.0.95.sh
    #!/bin/bash

    LD_PRELOAD=/opt/mysql-5.0.95/lib64/mysql/libmysqlclient.so.15 /opt/mysql-5.0.95/bin/mysqldump “$@”


Leave a Reply

Your email address will not be published. Required fields are marked *