You can use phpMyAdmin (if it's setup and probably would be on a commercial hosting site), the command prompt (assuming SSH [ or telnet - heaven forbid ] access), or a script in PHP. I'll show a little PHP script at the end.
Also, if you can make direct connections to the DB machine(s), you can install a number of tools on your local machine.
Two I use are:
MySQL Workbench (pro or community edition)
http://wb.mysql.com/
- And -
SQLyog (ultimate, enterprise, professional, or community)
http://webyog.com/en/index.php
- There are many more -
// El Cheap-o-php query analyzer...
-
-
// Connect…
-
mysql_connect('localhost','user','pwd');
-
-
// Add ‘EXPLAIN’ to head of your queries
-
$sql =
-
'EXPLAIN SELECT a.*
-
FROM bytes_help.workorder a
-
JOIN bytes_help.workorder b
-
ON b.id = mod(a.id,5)'; // A useless query...
-
-
// Do the query…
-
$rs = mysql_query($sql);
-
-
// Dump the execution plan...
-
print '<pre>'; // encapsulate with pre's to keep from having to 'view source'
-
while ($row = mysql_fetch_assoc($rs)) {
-
// Fetch into an associative array...
-
print_r($row);
-
}
-
print '</pre>';
-
-
// Output...
-
Array
-
(
-
[id] => 1
-
[select_type] => SIMPLE
-
[table] => a
-
[type] => ALL
-
[possible_keys] =>
-
[key] =>
-
[key_len] =>
-
[ref] =>
-
[rows] => 101
-
[Extra] =>
-
)
-
Array
-
(
-
[id] => 1
-
[select_type] => SIMPLE
-
[table] => b
-
[type] => eq_ref
-
[possible_keys] => PRIMARY
-
[key] => PRIMARY
-
[key_len] => 4
-
[ref] => func
-
[rows] => 1
-
[Extra] => Using where; Using index
-
)
-
-
-