mysqldump --help
mysqldump -uroot hellodb | gzip > /data/backup_mysql.sql.gz
mysqldump -uroot -B hellodb > /data/mysql_backup1.sql
mysqldump -uroot -A > /data/mysql_backup_all.sql
mysql -uroot < /data/mysql_backup1.sql
for i in `mysql -e 'show databases;' | egrep -v '^(database|information_schema|performance_schema|sys)$'` ; do mysqldump -B $i > /data/mysql_bak_$i_`data +%F`.sql
xtrabackup --help
主从
2-2-3
2个以上实例
2个二进制日志
3个线程
1、 server id
2、 授权用户名密码
3、 开启二进制日志
4、 二进制日志位置
~]# vim /etc/my.cnf.d/mysql-server.cnf标签:show,linux,server,cnf,回炉,MASTER,mysql,第二十四,data From: https://blog.51cto.com/dayu/6007568
[mysqld]
server-id=48
~]# systemctl restart mysqld
~]# mysql
> show master logs;
binlog.000002 | 156 | No
> create user repluser@'11.0.1.%' identified by '123456';
> grant replication slave on *.* to repluser@'11.0.1.%';
> show master logs;
| binlog.000002 | 681 | No |
~]# vim /etc/my.cnf.d/mysql-server.cnf
[mysqld]
server-id=68
~]# systemctl restart mysqld
~]# mysql
> help change master to
> CHANGE MASTER TO
MASTER_HOST='11.0.1.48',
MASTER_USER='repluser',
MASTER_PASSWORD='123456',
MASTER_PORT=3306,
MASTER_LOG_FILE='binlog.000002',
MASTER_LOG_POS=681,
MASTER_CONNECT_RETRY=10;
> start slave;
> show slave status\G