#基本操作权限
代码语言:javascript复制GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE VIEW, SHOW VIEW ON `db_dev`.* TO 'abc'@'192.168.1.%' IDENTIFIED BY 'xxxxx';
FLUSH PRIVILEGES;
#查看用户权限
代码语言:javascript复制show grants for 'care'@'192.168.1.%';
# 复制
代码语言:javascript复制CHANGE MASTER TO MASTER_HOST='192.168.x.x', MASTER_USER='xxx',MASTER_PASSWORD='xxx',MASTER_PORT=330x, MASTER_LOG_FILE='mysql-bin.00000x', MASTER_LOG_POS=1;
stop slave;
start slave;
show slave statusG
#创建操作
代码语言:javascript复制CREATE DATABASE db_name;
CREATE TABLE tbl_name (id int(4),name char(20));
INSERT INTO tbl_name (col1,col2) VALUES(15,col1*2);
#修改操作
代码语言:javascript复制ALTER TABLE chatter_users alter column ip varchar(50) NULL;
alter table address modify column city char(30);
alter table address modify column city varchar(50);
#删除操作
代码语言:javascript复制DROP DATABASE db_name;
DROP TABLE tbl_name;
TRUNCATE TABLE tbl_name;
#一致性检查与同步
代码语言:javascript复制#only sp master
pt-table-checksum --nocheck-replication-filters --replicate=pt.checksums h=h102,u=test,p=test,P=3307
pt-table-checksum --nocheck-replication-filters --nocheck-binlog-format --replicate=pt.check h=192.168.100.201,u=test,p=test
#only sp slave
pt-table-sync --replicate pt.checksums h=192.168.100.202,u=test,p='test' --sync-to-master --databases=test --tables=t1 --print
pt-table-sync --replicate pt.checksums h=192.168.100.202,u=test,p='test' --sync-to-master --databases=te