操作方法

先安装 screen 命令
创建一个窗口 screen -S aaa

screen -r aaa
进入执行相关命令

退出并且保留原来窗口
ctrl +a d

操作步骤

ALTER TABLE abc.accounts

ADD INDEX accounts_locked_index(locked) USING BTREE;

先试试,不执行具体操作

pt-online-schema-change --user=root --password=phfsefff–host=0.0.0.0 --alter “ADD INDEX accounts_locked_index(locked) USING BTREE;” D=abc,t=accounts --no-check-replication-filters --alter-foreign-keys-method=auto --charset=utf8 --chunk-size=250000 --dry-run --print

下面是直接操作

pt-online-schema-change --user=root --password=phfsefff–host=0.0.0.0 --alter “ADD INDEX accounts_locked_index(locked) USING BTREE;” D=abc,t=accounts --no-check-replication-filters --alter-foreign-keys-method=auto --charset=utf8 --chunk-size=250000 --execute --print

10-27 11:42