SQL是Structured Query Language(结构化查询语言)的缩写。SQL是专为数据库而建立的操作命令集,是一种功能齐全的数据库语言。在使用它时,只需要发出“做什么”的命令,“怎么做”是不用使用者考虑的。SQL功能强大、简单易学、使用方便,已经成为了数据库操作的基础,并且现在几乎所有的数据库均支持SQL。
1.使用前备份
mysqldump -uroot -p fission_statistics room_break_history > room_break_history_20170704.dump
2.pt-osc执行DDL
pt-online-schema-change --user='root' --host='localhost' --ask-pass --alter "CHANGE break_type break_type INT(11) NOT NULL,CHANGE app_id app_id INT(11) NOT NULL,CHANGE room_id room_id INT(11) NOT NULL,CHANGE from_user_id from_user_id INT(11) NOT NULL,CHANGE to_user_id to_user_id INT(11) NOT NULL,CHANGE content_type content_type INT(11) NOT NULL,CHANGE source_message source_message VARCHAR(1536) CHARSET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,CHANGE send_message send_message VARCHAR(1536) CHARSET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,CHANGE request_type request_type INT(4) NOT NULL,CHANGE handle_type handle_type INT(11) NOT NULL,CHANGE handle_uid handle_uid INT(11) NOT NULL,CHANGE create_time create_time DATETIME NOT NULL,DROP INDEX idx_from_user_id,ADD ?INDEX idx_handle_time (handle_type, create_time)" D=fission_statistics,t=room_break_history --execute
以上就是pt-osc使用一则的详细内容,更多请关注php中文网其它相关文章!
学习教程快速掌握从入门到精通的SQL知识。
关键词:pt-osc运用一则