Return to Snippet

Revision: 22881
at January 25, 2010 10:56 by ginoplusio

Initial Code
function fixTables($dbname) {
	// search for all the tables of
	// a db and run repair and optimize
	// note: this can take a lot of time
	// if you have big/many tables.
	$result = mysql_list_tables($dbname) or die(mysql_error());
	while ($row = mysql_fetch_row($result)) {
		mysql_query("REPAIR TABLE $row[0]");
		mysql_query("OPTIMIZE TABLE $row[0]");

Initial URL

Initial Description

Initial Title
Run REPAIR and OPTIMIZE on every table of your MYSQL DB

Initial Tags

Initial Language