标签:
1)备份 select * from t1 where id<5 into outfile ‘/tmp/t1id5.txt‘; 2)执行修改 begin; update t1 set b=100,c=100 where id<5; select * from t1 where id<5; rollback;/commit;
1)5.5版本: alter table t55 add c1 int; delete from t55 where id<100;(卡住一会后才执行) 2)5.6版本: use db1; alter table t55 add c1 int; delete from t55 where id<100;(执行顺畅) alter table t1 modify c1 varchar(90); delete from t55 where id<100;(卡住一会后才执行) 3)pt-online-schema-change工具 ./pt-online-schema-change --user=root --password=123456 --host=localhost --socket=/mysqldata/node4/mysqld.sock D=db55,t=t55 --alter "add c2 int" --print --dry-run
grant select,insert,delete on *.* to netease@‘localhost‘ identified by ‘163‘; #mysql -unetease -p163 --socet=/mysqldata/node3/mysqld.sock --port=4001(登陆成功) grant select,insert,delete on *.* to netease@‘localhost‘ identified by ‘123‘; #mysql -unetease -p163 --socet=/mysqldata/node3/mysqld.sock --port=4001(登陆失败)
4.导数据
use db1; select count(*) from t1;(先看一下数据量) 1)mysqldump导出 #mysqldump -uroot -p123456 --single-transaction --socket=/mysqldata/node3/mysqld.sock db1 t1 > /tmp/t1.sql grant select on *.* to netease@‘localhost‘ identified by ‘163‘; #mysqldump -unetease -p163 --socket=/mysqldata/node3/mysqld.sock db1 t1 > /tmp/t2.sql(报错,没有锁表权限) #mysqldump -unetease -p163 --single-transaction --socket=/mysqldata/node3/mysqld.sock db1 t1 > /tmp/t2.sql(成功) #mysqldump -uroot -p123456 --single-transaction --socket=/mysqldata/node3/mysqld.sock db1 t1 -T /tmp use db1; 2)以file权限into outfile导出数据 select * from t1 into outfile ‘/tmp/t1_2.txt‘; select t1.c,t3,b from t1.id=t3.id into outfile ‘/tmp/t13.txt‘;
总结
标签:
原文地址:http://www.cnblogs.com/Aiapple/p/5698157.html