91精产品自偷自偷综合官网版下载-91精产品自偷自偷综合下-91精品-91精品91久久久-91精品成人-91精品成人www

網站建設資訊

NEWS

網站建設資訊

Mysql中誤刪ibdataib_logfile等文件怎么辦-創新互聯

這篇文章主要介紹了Mysql中誤刪ibdata ib_logfile等文件怎么辦,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

創新互聯-專業網站定制、快速模板網站建設、高性價比舒城網站開發、企業建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式舒城網站制作公司更省心,省錢,快速模板網站建設找我們,業務覆蓋舒城地區。費用合理售后完善,10余年實體公司更值得信賴。

背景:誤刪ibdata等文件

  1. [root@localhost /var/lib/mysql ]# rm -rf ib*

  2. ib_buffer_pool  ibdata1         ib_logfile0     ib_logfile1     ibtmp1


此時不要驚慌,因為mysql還是在運行的,也行進行操作,,如果關了mysql那就沒辦法了,恢復步驟如下
1.關閉所有業務寫入

  1. flush tables with read lock


2.查看mysql的pid號

  1. [root@localhost /var/lib/mysql ]# ps -ef | grep -i mysql

  2. root       386     1  0 May06 ? 00:00:00 /bin/sh /usr/local/mariadb/bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf

  3. mysql      491   386  0 May06 ? 00:16:13 /usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mariadb --datadir=/usr/local/mariadb/demo --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/usr/local/mariadb/demo/mardb.err --pid-file=/usr/local/mariadb/demo/mardb.pid --socket=/usr/local/mariadb/demo/mardb.socket --port=3333

  4. root     14790     1  0 14:06 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql

  5. mysql 15010 14790  0 14:06 ? 00:00:05 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock

  6. root     18180 17974  0 15:03 pts/3    00:00:00 grep -i mysql

  7. [root@localhost /var/lib/mysql ]# netstat -nputl|grep -i mysql

  8. tcp        0      0 :::3333 :::* LISTEN      491/mysqld

  9. tcp        0      0 :::3306 :::* LISTEN 15010/mysqld



3 進入linux系統自帶的虛擬目錄proc查看文件是否還存在

  1. [root@localhost /var/lib/mysql ]# ll /proc/15010/fd | grep -i 'ib'
    lrwx------ 1 root root 64 May 12 15:03 10 -> /var/lib/mysql/ibtmp1 (deleted)
    lrwx------ 1 root root 64 May 12 15:03 3 -> /var/lib/mysql/ibdata1 (deleted)
    lrwx------ 1 root root 64 May 12 15:03 8 -> /var/lib/mysql/ib_logfile0 (deleted)
    lrwx------ 1 root root 64 May 12 15:03 9 -> /var/lib/mysql/ib_logfile1 (deleted)


4.輸入命令讓臟快速度刷新到磁盤

  1. mysql> set global innodb_max_dirty_pages_pct=0;


5 確保binlog pos和file不變

  1. mysql> show master status;

  2. +------------------+-----------+--------------+------------------+--------------------------------------------------+

  3. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |

  4. +------------------+-----------+--------------+------------------+--------------------------------------------------+

  5. | mysql-bin.000176 | 449250839 | | | 6c8a10ed-ed0b-11e4-91eb-00163ec546ca:1-212063619 |

  6. +------------------+-----------+--------------+------------------+--------------------------------------------------+

  7. 1 row in set (0.00 sec)


6.查看engine innodb的信息

  1. 如:

  2. mysql> show engine innodb status\G;
    *************************** 1. row ***************************
      Type: InnoDB
      Name: 
    Status: 
    =====================================
    2016-05-12 15:25:55 0x7f7692d0e700 INNODB MONITOR OUTPUT
    =====================================
    Per second averages calculated from the last 10 seconds
    -----------------
    BACKGROUND THREAD
    -----------------
    srv_master_thread loops: 35 srv_active, 0 srv_shutdown, 585 srv_idle
    srv_master_thread log flush and writes: 620
    ----------
    SEMAPHORES
    ----------
    OS WAIT ARRAY INFO: reservation count 17
    OS WAIT ARRAY INFO: signal count 15
    RW-shared spins 0, rounds 63, OS waits 6
    RW-excl spins 0, rounds 11, OS waits 0
    RW-sx spins 0, rounds 0, OS waits 0
    Spin rounds per wait: 63.00 RW-shared, 11.00 RW-excl, 0.00 RW-sx
    ------------
    TRANSACTIONS
    ------------
    Trx id counter 3625
    Purge done for trx's n:o < 3625 undo n:o < 0 state: running but idle   ==確認后臺進程吧undo log全部清除掉,事物id要一致
    History list length 71
    LIST OF TRANSACTIONS FOR EACH SESSION:
    ---TRANSACTION 421622043023184, not started
    0 lock struct(s), heap size 1136, 0 row lock(s)
    --------
    FILE I/O
    --------
    I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
    I/O thread 1 state: waiting for completed aio requests (log thread)
    I/O thread 2 state: waiting for completed aio requests (read thread)
    I/O thread 3 state: waiting for completed aio requests (read thread)
    I/O thread 4 state: waiting for completed aio requests (read thread)
    I/O thread 5 state: waiting for completed aio requests (read thread)
    I/O thread 6 state: waiting for completed aio requests (write thread)
    I/O thread 7 state: waiting for completed aio requests (write thread)
    I/O thread 8 state: waiting for completed aio requests (write thread)
    I/O thread 9 state: waiting for completed aio requests (write thread)
    Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
     ibuf aio reads:, log i/o's:, sync i/o's:
    Pending flushes (fsync) log: 0; buffer pool: 0
    459 OS file reads, 134 OS file writes, 55 OS fsyncs
    0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
    -------------------------------------
    INSERT BUFFER AND ADAPTIVE HASH INDEX
    -------------------------------------
    Ibuf: size 1, free list len 0, seg size 2, 0 merges         ===合并插入 insert buffer為1
    merged operations:
     insert 0, delete mark 0, delete 0
    discarded operations:
     insert 0, delete mark 0, delete 0
    Hash table size 34679, node heap has 0 buffer(s)
    Hash table size 34679, node heap has 0 buffer(s)
    Hash table size 34679, node heap has 0 buffer(s)
    Hash table size 34679, node heap has 0 buffer(s)
    Hash table size 34679, node heap has 0 buffer(s)
    Hash table size 34679, node heap has 0 buffer(s)
    Hash table size 34679, node heap has 0 buffer(s)
    Hash table size 34679, node heap has 0 buffer(s)
    0.00 hash searches/s, 0.00 non-hash searches/s
    ---
    LOG
    ---
    Log sequence number 14905664
    Log flushed up to   14905664
    Pages flushed up to 14905664
    Last checkpoint at  14905655                          ===確保三個日志記錄不再變化
    0 pending log flushes, 0 pending chkp writes
    55 log i/o's done, 0.00 log i/o's/second
    ----------------------
    BUFFER POOL AND MEMORY
    ----------------------
    Total large memory allocated 137428992
    Dictionary memory allocated 371621
    Buffer pool size   8192
    Free buffers       7862
    Database pages     330
    Old database pages 0
    Modified db pages  0          ====確認臟頁書數量為0
    Pending reads 0
    Pending writes: LRU 0, flush list 0, single page 0
    Pages made young 0, not young 0
    0.00 youngs/s, 0.00 non-youngs/s
    Pages read 296, created 34, written 72
    0.00 reads/s, 0.00 creates/s, 0.00 writes/s
    No buffer pool page gets since the last printout
    Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
    LRU len: 330, unzip_LRU len: 0
    I/O sum[0]:cur[0], unzip sum[0]:cur[0]
    --------------
    ROW OPERATIONS
    --------------
    0 queries inside InnoDB, 0 queries in queue
    0 read views open inside InnoDB
    Process ID=19640, Main thread ID=140146326370048, state: sleeping
    Number of rows inserted 34, updated 0, deleted 0, read 9
    0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s            ===確保插入 更新 刪除為0
    ----------------------------
    END OF INNODB MONITOR OUTPUT
    ============================


    1 row in set (0.00 sec)


    ERROR: 
    No query specified



6.將文件恢復并修改權限

  1. [root@localhost /proc/15010/fd ]# cp 10 /var/lib/mysql/ibtmp1

  2. [root@localhost /proc/15010/fd ]# cp 3 /var/lib/mysql/ibdata1

  3. [root@localhost /proc/15010/fd ]# cp 8 /var/lib/mysql/ib_logfile0

  4. [root@localhost /proc/15010/fd ]# cp 9 /var/lib/mysql/ib_logfile1

  5. [root@localhost /proc/15010/fd ]# chown mysql.mysql /var/lib/mysql/ibtmp1

  6. [root@localhost /proc/15010/fd ]# chown mysql.mysql /var/lib/mysql/ibdata1

  7. [root@localhost /proc/15010/fd ]# chown mysql.mysql /var/lib/mysql/ib_logfile*


7。重啟mysql即可

感謝你能夠認真閱讀完這篇文章,希望小編分享的“Mysql中誤刪ibdata ib_logfile等文件怎么辦”這篇文章對大家有幫助,同時也希望大家多多支持創新互聯,關注創新互聯-成都網站建設公司行業資訊頻道,更多相關知識等著你來學習!


網站名稱:Mysql中誤刪ibdataib_logfile等文件怎么辦-創新互聯
文章源于:http://www.yuzhuanjia.cn/article/cosheh.html
主站蜘蛛池模板: 91精品国产肉丝高跟在线 | www.日日日| 成电影人免费网站 | 99久久久精品免费观看国 | 91视频免费看平台的优点有哪些 | 99精品人妻无码专区在线视频 | av午夜精品一区二区三 | 成人黄色在线观看 | 91视频免费网址 | 丰满人妻av无码一区二区软件 | 99久久久无码国产精品6 | 91亚洲高清在线观看 | 国产av高清和老师偷尝禁果 | 91福利国产在 | 91香蕉国产在线观看免费永久 | 99国产午夜精品一区二区天美 | av人摸人人人澡人人超碰小说 | 午夜热搜电影天堂在线观看全集免费 | 一区二区三区日韩欧美 | 丰满少妇在线观看网站 | 99tv人人草在线视频 | av日韩国产一区二区三区 | 午夜成人亚洲理论片在线观看 | 果冻传媒色av国产在线播放 | 日韩av无码久久一区二区 | 91无码视频在线观看 | AV国産精品毛片一区二区 | 91成人免费观看在线观看 | 天美传媒在线完整免费 | 97人妻在线| 91精品蝌蚪 | 懂色一区二区二区av免费观看 | 1024国产精品视频一区 | 午夜成人毛片视频免费看 | 91精品在线视频观看 | 91香蕉国产线观看免费 | 91精品国产成人久久久久久 | 国产91特黄特色a级毛片 | 午夜性色福利视频 | 18处破外女出血视频在线观看 | 99久久精品国产第一页 |