#!/bin/bash
cnn_db=$1
table=$2
alter_conment=$3
cnn_host='192.168.10.14'
cnn_user='root'
cnn_pwd='123456'
echo "$cnn_db"
echo "$table"
echo "$alter_conment"
/application/search/script/percona-toolkit-2.1.1/bin/pt-online-schema-change --user=${cnn_user} --password=${cnn_pwd} --host=${cnn_host} --port=3306 --charset=utf8 D=${cnn_db},t=$table --alter="${alter_conment}" --execute
用法:sh pt.sh test user "ADD COLUMN age tinyint(4) DEFAULT NULL"
注释:传入3个参数,db、table、要改的字段