站内搜索

mysql数据库碎片整理脚本_MySQL

<?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]=='information_schema'||$row[0]=='performance_schema'){//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].'.'.$value[0];			$r=mysql_query($sql);			if($r){				//echo "ok";			}else{				echo "fail";			}		}}?>

当一个服务器上有较多网站时 。可能会用得上。在执行之前请备份
  • 上一篇:【MySQL案例】error.log的Warning:If a crash happens thisconf_MySQL
  • 下一篇:Percona Thread Pool性能基准测试_MySQL