Wednesday, November 16, 2016

ERROR 1794 (HY000) at line 1: Slave is not configured or failed to initialize properly.

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.

I see this error when I am adding a new MySQL 5.6 slave to a MySQL 5.5 master. Before I get the error, I've used Xtrabackup to backup the MySQL 5.5 and restored onto the MySQL5.6 server without running mysql_upgrade on the MySQL 5.6.

The MySQL error log will have message like this before doing anything:

2016-10-27 12:31:28 24365 [ERROR] Native table 'performance_schema'.'socket_summary_by_instance' has the wrong structure
2016-10-27 12:31:28 24365 [ERROR] Native table 'performance_schema'.'socket_summary_by_event_name' has the wrong structure
2016-10-27 12:31:28 24365 [ERROR] Native table 'performance_schema'.'session_connect_attrs' has the wrong structure
2016-10-27 12:31:28 24365 [ERROR] Native table 'performance_schema'.'session_account_connect_attrs' has the wrong structure

I will drop the performance_schema like this:

mysql> drop database if exists performance_schema;
Query OK, 17 rows affected (0.08 sec)

Then run mysql_upgrade like this:

mysql_upgrade -uUSERNAME -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.servers                                      OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Running 'mysql_fix_privilege_tables'...
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
<db_name>.<table_name>                         OK

OK

Then you can add it into the cluster:

STOP SLAVE;
RESET SLAVE;
CHANGE MASTER TO MASTER_HOST='<sever_name>',MASTER_USER='<replication_user>', MASTER_PASSWORD='<replication_passwor>', MASTER_LOG_FILE='mysqld-bin.000006', MASTER_LOG_POS=67549518;
START SLAVE;

show slave status \G 



No comments:

Post a Comment