飞天使-pt-online-schema-change 添加索引方法,不锁表

操作方法

先安装 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

相关推荐
Java面试题总结13 分钟前
htop安装不了怎么解决
mysql
钰衡大师19 分钟前
MySQL 数据库备份方案
数据库·mysql
原来是猿2 小时前
MySQL【事务下】
数据库·mysql·oracle
奕成则成2 小时前
面试被问:MySQL 与 Doris/SelectDB 的架构区别。 大数据为什么禁止select *。
mysql·面试·架构
gjc5922 小时前
踩坑实录:MySQL服务器CPU爆高,元凶竟是SELinux的setroubleshootd?
运维·服务器·数据库·mysql·adb
Bat U3 小时前
MySQL数据库|建库&建表&数据类型
数据库·mysql
2401_884662103 小时前
计算机的基本概念
mysql
yhole4 小时前
MySQL无法连接到本地localhost的解决办法2024.11.8
数据库·mysql·adb
jinanmichael4 小时前
mysql用户名怎么看
数据库·mysql
guslegend4 小时前
MySQL高手第一章
mysql·adb