<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] > [參考網站](https://juejin.cn/post/6844903511201677325#heading-9) ## 概述 如果是maridb 則 為 maria_bin.xxx ## 實例 ### 備份數據庫 ``` > ./mysqldump -uroot -ppassword -l -F t2 > t2.dmp 參數說明: -l 參數表示給所有表加讀鎖 -F 表示生成一個新的日志文件 ``` 為了便于測試,執行 reset master 刪除所有 binlog ``` MySQL [(none)]> reset master; Query OK, 0 rows affected (0.00 sec) # 此時只有一個 binlog 日志文件 mysql-bin.000001 MySQL [t2]> select * from test; +------+------+ | id | name | +------+------+ | 1 | a | | 2 | b | +------+------+ ``` ### 備份完畢后,插入新的數據 因為上一步執行是加入了 -F 選項, 所以接下來的操作會被記錄到新的二進制文件,即名為 mysql-bin.000002 的文件 ``` MySQL [t2]> insert into test values (3,'c'); MySQL [t2]> insert into test values (4,'d'); ``` ### 模擬故障-刪庫 ``` // 這里為了便于測試,不把刪庫操作記入日志,當前 session 設置 sql_log_bin 為 off。 // 刪庫后,執行 flush logs,讓后續的 binlog 到新的文件中,即名為 mysql-bin.000003中 MySQL [t2]> set sql_log_bin = 0; MySQL [t2]> show variables like "%sql_log_bin%"; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | sql_log_bin | OFF | +---------------+-------+ 1 row in set (0.00 sec) MySQL [t2]> drop database t2; MySQL [(none)]> flush logs; MySQL [t2]> drop database t2; ``` ### 恢復備份 ``` > ./mysql -e "create database t2" > ./mysql t2 < t2.dmp ----- MySQL [t2]> select * from test; +------+------+ | id | name | +------+------+ | 1 | a | | 2 | b | +------+------+ ``` ### 恢復 binglog - 使用 mysqlbinlog 還原 binlog日志 - 備份的時間點到刪庫的時間點之間的操作被記錄到了 mysql-bin.000002 文件中 ``` > ./mysqlbinlog --no-defaults /data/mysql/mysql-bin.000002 | ./mysql t2 ******************************************************* MySQL [t2]> select * from test; +------+------+ | id | name | +------+------+ | 1 | a | | 2 | b | | 3 | c | | 4 | d | +------+------+ ``` 數據恢復成功
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看