飞天使-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

相关推荐
小王努力学编程7 小时前
【MySQL篇】表的操作
数据库·mysql
汤汤upup7 小时前
面试八股文--数据库基础知识总结(2) MySQL
数据库·mysql·面试
TangKenny7 小时前
information_schema.processlist 表详解
mysql·processlist
m0_7482509310 小时前
mysql数据被误删的恢复方案
数据库·mysql
m0_7482384210 小时前
MySQL Workbench菜单汉化为中文
android·数据库·mysql
一小路一10 小时前
从0-1学习Mysql第五章: 索引与优化
数据库·后端·学习·mysql·面试
彤彤的小跟班11 小时前
MySQL进阶04-MVCC实现原理
数据库·mysql
huaqianzkh12 小时前
基于 ‌MySQL 数据库‌对三级视图(用户视图、DBA视图、内部视图)的详细解释
数据库·mysql·dba
ForTodayzzZ12 小时前
centos和ubuntu安装mysql教程
linux·mysql·ubuntu·centos
扣丁梦想家12 小时前
《Spring Boot + MySQL高性能应用实战:性能优化技巧与最佳实践》
spring boot·后端·mysql