mysql之資料庫主從複製配置報錯1677

來源:互聯網
上載者:User

標籤:rom   character   com   資料   comm   default   user   stop   配置   

mysql之資料庫某表字元集和資料庫字元集不一致導致主從複製配置報錯1677
mysql資料庫中某張表字元集是utf8而my.cnf設定的資料庫的字元集是utf8mb4,導致在配置主從複製時,報如下錯誤

  Last_Errno: 1677                   Last_Error: Column 1 of table ‘novel.novel_mp_custom‘ cannot be converted from type ‘tinyint‘ to type ‘int(5)‘

原因:
表字元集和資料庫字元集不一致導致的
解決過程如下:

主庫79查看資料庫字元集和報錯表的字元集:

mysql> show create database novel\G*************************** 1. row ***************************       Database: novelCreate Database: CREATE DATABASE `novel` /*!40100 DEFAULT CHARACTER SET utf8mb4 */mysql>  show create table  novel_mp_custom\G*************************** 1. row ***************************       Table: novel_mp_customCreate Table: CREATE TABLE `novel_mp_custom` (  `id` int(5) NOT NULL AUTO_INCREMENT COMMENT ‘客服訊息自增ID‘,  `push_num` int(6) NOT NULL DEFAULT ‘0‘ COMMENT ‘成功發送次數‘,  PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8 COMMENT=‘客服訊息‘1 row in set (0.00 sec)

修改主庫79機器上表字元集為utf8mb4:

mysql> alter table `novel_mp_custom`   convert to character set  utf8mb4;Query OK, 61 rows affected (0.01 sec)Records: 61  Duplicates: 0  Warnings: 0

重設79機器上主master資訊:
reset master
重新授權同步賬戶:

mysql> grant replication slave on *.* to [email protected]‘10.80.0.2‘ identified by ‘[email protected]‘; flush privileges;Query OK, 0 rows affected, 1 warning (0.00 sec)

79機器上重新dump資料:

mysqldump -uroot -p‘5Z$AJ$Jt5ert321‘ -A  -B -F --master-data=2 --single-transaction  --events >/root/222.novel.sql scp -r -i shuosir_key -P 12089 222.novel.sql [email protected]:/root/

5機器上操作:

mysql>stop slave;reset slave all;mysql> source /root/333.novel.sql;CHANGE MASTER TOMASTER_HOST=‘10.80.0.1‘,MASTER_PORT=3306,MASTER_USER=‘novelrep‘, MASTER_PASSWORD=‘[email protected]‘;start slave;show slave status\G

到處主從複製報錯解決

mysql之資料庫主從複製配置報錯1677

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.