Home >Database >Mysql Tutorial >mysql数据库碎片整理脚本_MySQL

mysql数据库碎片整理脚本_MySQL

WBOY
WBOYOriginal
2016-05-31 08:49:191016browse
<?phperror_reporting (E_ALL);mysql_connect("localhost","root","12344321");mysql_query("set names utf8");$resource=mysql_query("show databases");while($row=mysql_fetch_array($resource)){		if($row[0]==&#39;information_schema&#39;||$row[0]==&#39;performance_schema&#39;){//performance_schema			continue;		}		$sql=" use ".$row[0];		mysql_query($sql);		$result=mysql_query("show tables");		while($value=mysql_fetch_array($result)){			$sql="optimize table ".$row[0].&#39;.&#39;.$value[0];			$r=mysql_query($sql);			if($r){				//echo "ok";			}else{				echo "fail";			}		}}?>

当一个服务器上有较多网站时 。可能会用得上。在执行之前请备份
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn