一、防火墙的开启、关闭、禁用命令
(1)设置开机启用防火墙:systemctl enable firewalld.service
(2)设置开机禁用防火墙:systemctl disable firewalld.service
(3)启动防火墙:systemctl start firewalld
(4)关闭防火墙:systemctl stop firewalld
(5)检查防火墙状态:systemctl status firewalld
 永久关闭selinux下的强制检查:
      要把vim  /etc/selinux/config 
	     中的  SELINUX=enforcing
		 变为  SELINUX=disabled  
	  然后重启虚拟机  如果不重启还需要在输入一条命令:setenforce  0
主服务器配置:vim /etc/my.cnf
       添加:log-bin=mysql-bin
            server-id=100
从服务器配置:vim /etc/my.cnf
      添加:relay-log=relay-log-bin
           server_id=101
           read-only=on
		   
主从复制的配置:
       vim /var/lib/mysql/auto.cnf    //注意:内容要不一样
		   
配置完都要重启mysql:	systemctl restart mysqld
主: mysql> set global validate_password_policy=low;
    mysql> set global validate_password_length=4;
    mysql> grant replication slave on *.* to ‘yyc‘@‘%‘ identified by ‘666666‘;
    mysql> show master status\G;
   
从: mysql> help change master to
    mysql> change master to
        -> master_host=‘%‘,
        -> master_user=‘yyc‘,
        -> master_password=‘666666‘,
        -> master_port=3306,
        -> master_log_file=‘mysql-bin.000002‘,
        -> master_log_pos=1088;
    Query OK, 0 rows affected, 2 warnings (0.01 sec)
    mysql> start slave;
    Query OK, 0 rows affected (0.00 sec)
    mysql> show slave status\G;
	  查看:  Slave_IO_Running: Yes      // 是否是:yes
	        Slave_SQL_Running: Yes
主: 主服务器的数据库要完全备份:
       mysqldump --user=root -p --lock-all-tables --all-databases > all.sql
     把主服务器的备份传到从服务器:
	  scp ./all.sql root@172.16.188.242:/root/
从: 从数据库中把传过来的备份恢复:
        source /root/all.sql
 
     注意: ---------试试从数据库有没有同步---------
 
 
 立即启动一个服务:
       systemctl start apache.service
 立即停止一个服务:
       systemctl stop apache.service
 重启一个服务
       systemctl restart apache.service
show variables like ‘%format‘;
show variables like ‘%image‘;
主从复制的启动跟关闭:
启动:start slave;
停止:stop slave;
原文:https://www.cnblogs.com/yangyongchao/p/12331315.html