十年網(wǎng)站開(kāi)發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營(yíng)維護(hù)+專業(yè)推廣+無(wú)憂售后,網(wǎng)站問(wèn)題一站解決
本篇文章給大家分享的是有關(guān)MySQL中怎么找回用戶數(shù)據(jù),小編覺(jué)得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說(shuō),跟著小編一起來(lái)看看吧。
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:主機(jī)域名、虛擬主機(jī)、營(yíng)銷軟件、網(wǎng)站建設(shè)、泉州網(wǎng)站維護(hù)、網(wǎng)站推廣。
解決過(guò)程
1、首先想到的是直接從定時(shí)備份數(shù)據(jù)里面找回原來(lái)的用戶ID,結(jié)果發(fā)現(xiàn)系統(tǒng)只備份了十天的記錄,而工作流系統(tǒng)上顯示銷售C只有8月3號(hào)以后的流程記錄,距今已經(jīng)40多天,從自動(dòng)備份的數(shù)據(jù)里已經(jīng)無(wú)法恢復(fù)。
2、所以,只能從數(shù)據(jù)庫(kù)的二進(jìn)制記錄里分析了。進(jìn)入MySQL數(shù)據(jù)存放的目錄:
3、通過(guò)分析文件修改時(shí)間,得知?jiǎng)h除操作的動(dòng)作在mysql-bin.000014文件里面記錄。
4、因?yàn)槿罩疚募嵌M(jìn)制的,所以導(dǎo)出日志為sql文件:
mysqlbinlog --no-defaults mysql-bin.000014 > workflow_operator.sql
5、日志記錄比較大,導(dǎo)出后有132M,壓縮打包文件并下載到本地,只有15.2M
tar -czvf workflow_operator.tar.gz workflow_operator.sql
6、在本地使用文本工具,查找所有的刪除用戶的操作:
***定位刪除銷售C的動(dòng)作在127766行(雖然日志記錄行數(shù)比較多,但是刪除用戶的動(dòng)作比較少,所以好排查)
7、用戶ID找到了,所幸的是,因?yàn)橹粍h除了用戶,沒(méi)有刪除流程數(shù)據(jù)(因?yàn)榱鞒虜?shù)據(jù)是要存檔的),所以只要把銷售C的舊流程數(shù)據(jù)user_id換成新的user_id就可以了,流程表比較多,通過(guò)體力勞動(dòng),找出有舊ID的表,然后再使用update語(yǔ)句一起更新,終于找回了所有數(shù)據(jù):
(***四位由于涉及隱私,使用XXX代替)
update flow_fr_borrow set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_fr_cost set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_fr_fixedasset set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_fr_house_lease set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_fr_purchase set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_fr_travel set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_hr_positive set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_pr_equip_borrow_sale set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_pr_equip_return set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_sa_tepe set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_sa_safore set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_sa_authorize set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_sa_business set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'; update flow_hr_trial set sel_user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where sel_user_id = '66adfd032ccf428d9e20e864f729xxxx' ; update wf_hist_order set creator = 'e76cb8bccaf74f32b94d17f74437xxxx' where creator = '66adfd032ccf428d9e20e864f729xxxx'; update wf_hist_task set operator = 'e76cb8bccaf74f32b94d17f74437xxxx' where operator = '66adfd032ccf428d9e20e864f729xxxx'; update wf_order set creator = 'e76cb8bccaf74f32b94d17f74437xxxx' where creator = '66adfd032ccf428d9e20e864f729xxxx'; update wf_hist_task_actor set actor_Id = 'e76cb8bccaf74f32b94d17f74437xxxx' where actor_Id = '66adfd032ccf428d9e20e864f729xxxx';
以上就是MySQL中怎么找回用戶數(shù)據(jù),小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見(jiàn)到或用到的。希望你能通過(guò)這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。