Friday 25 April 2014

Automatically optimize all tables in a MySQL database

Automatically optimize all tables in a MySQL database
Use this script preferably with a cronjob to automatically optimize all the tables in your database. Under root privilleges the script will search for all the databases in your server and will optimize them all.

Just change the connection variables ($h, $u, $p) and execute it from your browser.

Code:
<?php
echo '<pre>' . "\n\n";
set_time_limit( 100 );

  $time = microtime();
  $time = explode(' ', $time);
  $time = $time[1] + $time[0];
  $start = $time;
 
//Connection variables :
$h = 'localhost';
$u = 'root';

No comments:

Post a Comment