[root@Master ~]# mysql -uroot -p123
mysql> create database test1;
mysql> create database test2;
4.配置 MySQL 数据库用户授权
mysql> grant all on test1.* to zhangsan@‘192.168.1.%’ identified by ‘123’;
mysql> grant all on test2.* to lisi@‘192.168.1.%’ identified by ‘123456’;
mysql> flush privileges;
mysql> exit;
===============================================================================
1.安装 Mariadb 数据库
[root@Backup ~]# yum -y install mariadb # 安装系统自带 MySQL 数据库
[root@Backup ~]# mysql -uzhangsan -p123 -h192.168.1.1 # 验证远程登陆 MySQL
MySQL [(none)]> exit
2.使用 mysqldump 进行远程备份测试
[root@Backup ~]# mysqldump -uzhangsan -p123 -h192.168.1.1 test1 > test1.sql
================================================================================================
Backup 上操作:
[root@Backup ~]# mkdir /mysql.bak # 创建备份目录
[root@Backup ~]# cd /mysql.bak # 进入备份目录
[root@Backup mysql.bak]# vim mysql.sh # 编写备份脚本
#!/bin/bash
#定义数据库连接. 目标库信息
my_user1=“zhangsan”
my_user2=“lisi”
my_pass1=“123”
my_pass2=“123456”
my_host=“192.168.1.1”
my_conn1=“-u m y u s e r 1 −