您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“有哪些方法可以修復(fù)mysql表”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“有哪些方法可以修復(fù)mysql表”吧!
修復(fù)mysql表第一種方法:
shell>mysqlcheck-r-c-o-uuser-ppasswddb_name
修復(fù)mysql表第二種方法,用以下這個(gè)腳本,從網(wǎng)上下的,似很管用.將這個(gè)腳本放在你的web根目錄下,然后從web頁面運(yùn)行這個(gè)腳本.
修復(fù)mysql表的方法有哪些
catrepair.php需要修改$dbuser="root";--->需要修改$dbpw="";--->需要修改$dbname="db_name";-->需要修改#$table="search_profile";mysql_connect($dbhost,$dbuser,$dbpw);mysql_select_db($dbname);if(!get_cfg_var("register_globals")){foreach($HTTP_GET_VARSas$key=>$val){$$key=$val;}}functionchecktable($table,$loops=0){global$db,$nohtml;$result=mysql_query("CHECKTABLE$table");if(!$nohtml){echo"Checkingtable$table";echo"TableOperationTypeText";}else{echo"\n>>>>>>>>>>>>>CheckingTable$table\n";echo"---------------------------------\n";}$error=0;while($r=mysql_fetch_row($result)){if($r[2]=='error'){if($r[3]=="Thehandlerforthetabledoesn'tsupportcheck/repair"){$r[2]='status';$r[3]='Thistabledoesnotsupportcheck/repair/optimize';unset($bgcolor);$nooptimize=1;}else{$error=1;$bgcolor='red';unset($nooptimize);}}else{unset($bgcolor);unset($nooptimize);}if(!$nohtml){echo"$r[0]$r[1]$r[2]$r[3]";}else{echo"$r[0]|$r[1]|$r[2]|$r[3]\n";}}if($error){if(!$nohtml){echo"Repairingtable$table";}else{echo">>>>>>>>>>>>>RepairingTable$table\n";}$result2=mysql_query("REPAIRTABLE$table");if($result2[3]!='OK')$bgcolor='red';elseunset($bgcolor);if(!$nohtml){echo"$result2[0]$result2[1]$result2[2]$result2[3]";}else{echo"$result2[0]|$result[1]|$result2[2]|$result2[3]\n";}}if(($result2[3]=='OK'||!$error)&&!$nooptimize){if(!$nohtml){echo"Optimizingtable$table";}else{echo">>>>>>>>>>>>>OptimizingTable$table\n";}$result3=mysql_query("OPTIMIZETABLE$table");$error=0;while($r3=mysql_fetch_row($result3)){if($r3[2]=='error'){$error=1;$bgcolor='red';}else{unset($bgcolor);}if(!$nohtml){echo"$r3[0]$r3[1]$r3[2]$r3[3]";}else{echo"$r3[0]|$r3[1]|$r3[2]|$r3[3]\n";}}}if($error&&$loops){checktable($table,($loops-1));}}if($check){$tables=mysql_query("SHOWTABLES");if(!$nohtml){echo"";}if($iterations){$iterations--;}while($table=mysql_fetch_row($tables)){if(substr($table[0],-8)!='sessions'){$answer=checktable($table[0],$iterations);if(!$nohtml){echo"";}flush();}}if(!$nohtml){echo"";}}else{echo"DatabaseTableRepairUtilityforDiscuz!(RequireMySQL3.23)"."Thisscriptwillattempttorepaircorrupteddatabases.Whileitcanrepairmostcommonerrors,"."itcannotrepaireverything.Asasidebenefititwillalsooptimizeyourtables."."ThisscriptwascopyrightedbyJelsoftandmodifiedbyCrossdayStudiotomakeitapplyforDiscuz!."."Usage:"."iterations=x(xisthenumberoftimesyouwishforthescripttoattempttorepairabrokentable)"."nohtml=1(Outputtextonlynohtml.Usefulforcronjobsandyouwishtoreceivetextonly)"."check=1(withoutthisyouwillgetthisscreenandnochecking)"."ExampleUsage:"."repair.phphtml=1&check=1(mostcommonusage,willcheckaforumandreturnhtmlresults)"."repair.phpcheck=1&iterations=5(trytorepairdamagedtables5times)"."";}>
到此,相信大家對“有哪些方法可以修復(fù)mysql表”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。