[root@mster-k8s ~]# mariadb
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 23
Server version: 10.6.7-MariaDB MariaDB Server
Copyright (c)2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
二、配置二进制日志功能
1.修改/etc/my.conf
[root@mster-k8s ~]# vim /etc/my.cnf[root@mster-k8s ~]# cat /etc/my.cnf## This group is read both by the client and the server# use it for options that affect everything#[client-server]## include *.cnf from the config directory#!includedir /etc/my.cnf.d
[mysqld]log_bin=mysql-bin
2.重启服务
systemctl restart mariad
3.查看二进制日志文件
4.查看binlog开启状态
MariaDB [(none)]> show global variables like 'log_bin';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin | ON |
+---------------+-------+
1 row inset(0.001 sec)
MariaDB [(none)]>
mysql -uroot -p123 test_huawei < ./huawei_student.sql
④检查恢复的表
MariaDB [(none)]> use test_huawei;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [test_huawei]> show tables;
+-----------------------+
| Tables_in_test_huawei |
+-----------------------+
| student |
+-----------------------+
1 row inset(0.000 sec)
MariaDB [test_huawei]>select * from student;
+----+--------+--------+------+-------+--------+-------+
|id| name | gender | age | class | course | grade |
+----+--------+--------+------+-------+--------+-------+
|1| 张三 |0|18|3| 语文 |98||2| 李四 |0|17|3| 数学 |95||3| 王五 |1|16|2| 物理 |88||4| 高峰 |0|22|4| 英语 |100||5| 陈林 |1|15|5| 化学 |99|
+----+--------+--------+------+-------+--------+-------+
5 rows inset(0.000 sec)