1
notgod 2016-06-05 18:49:34 +08:00
mysqld: unknown variable ‘ master-host=
Are you trying to setup on replication on mysql5.5+ ? ok. then that ’ s the issue. The following options are removed in MySQL 5.5. If you attempt to start mysqld with any of these options in MySQL 5.5, the server aborts with an unknown variable error. – master-host – master-user – master-password – master-port Solution, comment the master- related variables. Do following, On Master: mysql>GRANT REPLICATION SLAVE ON *.* TO ‘ slave_user ’@’%’ IDENTIFIED BY ‘‘; (Replace with a real password!) mysql>FLUSH PRIVILEGES; mysql>FLUSH TABLES WITH READ LOCK; mysql>SHOW MASTER STATUS; # get the DB dump. mysql>UNLOCK TABLES; On Slave: # import the DB dump mysql>stop slave; mysql>CHANGE MASTER TO MASTER_HOST=’ prod_master ’, MASTER_USER=’ slave_user ’, MASTER_PASSWORD=’‘, MASTER_LOG_FILE=’ mysql-bin.0xx ‘, MASTER_LOG_POS=33421; mysql>start slave; Ref: http://dev.mysql.com/doc/refman/5.5/en/replication-options-slave.html |
2
notgod 2016-06-05 18:50:49 +08:00 1
由於 mysql 5.5 開始不支援 my.cnf 裡 master-host 等的設定
所以不能把 master 的參數設定到裡頭 只能透過 sql 指令的方式建立 replication 連結 不然會看到下面錯誤訊息 Installing MariaDB/MySQL system tables in '/home/mysql/data' ... 130208 7:08:31 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable 'master-host=192.168.100.1' 130208 7:08:31 [ERROR] Aborting 以下是針對 slave 的操作步驟: install mysql start mysql restore db SQL : slave stop SQL : change master to master_host='192.168.100.1', master_port=3306, master_user='repl', master_password='xxxxxxx'; SQL : slave start |