title: Mysql slave gets ruined after a restart
body: <p>Please help!</p>
  
  <p>I set up a master-slave replication based on the GTID mechanism.
  The replication works OK, until a mysqld restart happens on slave. Then the mess begins...</p>
  
  <p>After such a restart, I can not restore the replication.
  When issuing a "START SLAVE"  command I get the following an error message:</p>
  
  <blockquote>
    <p>ERROR 1794 (HY000) at line 1: Slave is not configured or failed to
    initialize properly. You must at least set --server-id to enable
    either a master or a slave. Additional error messages can be found in
    the MySQL error log.</p>
  </blockquote>
  
  <p>Needless to say I did set server-id in my.cnf (see below).</p>
  
  <p>In /var/log/mysqld.log file, I found the following error message: </p>
  
  <blockquote>
    <p>[ERROR] Error creating master info: Multiple replication metadata
    repository instances found with data in them. Unable to decide which
    is the correct one to choose.</p>
    
    <p>[ERROR] Failed to create or recover replication info repository.</p>
  </blockquote>
  
  <p>I can not understand what have I done wrong.</p>
  
  <p>The communication between master and slave is ssl-tunneled through stunnel, but I don't think this is a relevant fact, since until a restart everything works right.</p>
  
  <p>The only way I found to re-establish the replication (after mysql restart) is to manually delete the mysql data files, and then load again the dump file imported from the master. (I use mysqldump). This is of course unreasonable.</p>
  
  <p>Following are the my.cnf files:</p>
  
  <p>On slave:</p>
  
  <pre><code>[mysqld]
  datadir=/var/lib/mysql
  socket=/var/lib/mysql/mysql.sock
  
  # Disabling symbolic-links is recommended to prevent assorted security risks
  symbolic-links=0
  
  # Recommended in standard MySQL setup
  sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
  server-id=2
  log-bin=mysql-bin
  binlog_format=ROW
  relay_log=relay-log
  skip-slave-start
  enforce-gtid-consistency
  gtid-mode=ON
  log-slave-updates
  [mysqld_safe]
  log-error=/var/log/mysqld.log
  pid-file=/var/run/mysqld/mysqld.pid
  </code></pre>
  
  <p>On mater:</p>
  
  <pre><code>[mysqld]
  server-id=1
  log-bin=mysql-bin
  binlog_format=ROW
  gtid-mode=on
  enforce-gtid-consistency
  log-slave-updates
  innodb_buffer_pool_size = 1G
  query_cache_size = 32M
  </code></pre>
  
  <p>Slave machine: Centos 6.6, mysql 5.6.24.</p>
  
  <p>Master machine: RHEL 6.6, mysql 5.6.10.</p>
  
  <p>Any help wold be greatly appreciated!</p>
  
  <p>Thanks</p>
  
  <p>Nadav Blum </p>