MySQL 常用语句

查看 binlog 是否开启
show variables like '%log_bin%'

开启 binlog
[mysqld]
log-bin=mysql-bin(随意写)

主从同步
binlog_format=ROW
server_id = 1

授权
GRANT SELECT, REPLICATION SLAVE,REPLICATION CLIENT ON *.* TO 'gosync'@'172.16.33.%/255.255.240.0' identified by 'password';

撤销权限
REVOKE SELECT,'REPLICATION SLAVE','REPLICATION CLIENT' FROM 'gosync'@'172.22.48.0/255.255.240.0';

修改用户密码
mysqadmin -u gosync -p password

刷新权限(更改生效)
FLUSH PRIVILEGES;

评论