目的
线上一张表的字段长度变更
`sGuid` varchar(255) DEFAULT NULL COMMENT 'sGuid'
=》
`sGuid` varchar(512) DEFAULT NULL COMMENT 'sGuid'
方法
pt-online-schema-change --user=xxxx--password=xxxxxx --host=127.0.0.1 --port=3306\--charset=utf8mb4 D=db_main,t=tb_main \--alter "modify sGuid varchar(512) DEFAULT NULL COMMENT 'sGuid'"\--no-check-alter --no-check-replication-filters --alter-foreign-keys-method=auto --recursion-method=none \--critical-load="Threads_running=50" --max-load="Threads_running=100"\--print --execute
执行时报错:
2019-07-25T11:03:00 Error copying rows from `db_main`.`tb_main` to `db_main`.`_tb_main_new`: 2019-07-25T11:03:00 Copying rows caused a MySQL error 1300:
Level: Warning
Code:1300Message: Invalid utf8 characte