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

  • Post author:
  • Post category:MySQL

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

This Post Has 20 Comments

  1. Lance

    Thank you!

  2. Siros

    Thank you so much !!

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

  3. Paul

    Brilliant, thanks.

  4. Lx

    Thanks, precious tip!

  5. Gerson Jr

    Thank you!

  6. Sysadmin

    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 “$@”

Comments are closed.