myrep: PHP MySQL Repair ScriptPurplePixie Home | Dave Online

A PHP Script to automate MySQL table checking and repairing from the command-line.

When run myrep will go through all the tables in a database checking and/or repairing them as specified in the options.

Usage
 php myrep.php [options] -d database

 Command Options:

 -r --repair      Do a repair if required or not checked
 -n --nocheck     Don't check just do a repair (if -r is set)
 -w --warnings    Repair tables with warnings (ignored if -n is set)
 -u --username X  Login with username of X
 -p --password X  Login with password of X
 -s --server X    Connect to server X
 -d --database X  Use database X (required)
For each option a quick and long option can be used interchangeable i.e. -r and --repair are the same.

Defaults: username root, password blank, server 127.0.0.1, check yes, repair on warnings no, repair no.

myrep will loop through all the tables in a database, checking them (unless --nocheck is set) and reporting status to the screen. After checking (if --repair is set) the table will be repaired if it contains errors (or has warnings and --warnings is set).

If --nocheck and --repair are set then all tables will be repaired as their status has not been determined.

Examples
 php myrep.php -u someuser -p secret -s somehost -d somedb
Will connect to the MySQL server somehost as someuser:secret and check all the tables in somedb. No repairs will be attempted regardless of the outcome (as --repair is not set).

 php myrep.php -w -r -d somedb
Will connect to the default server (127.0.0.1) with default credentials (root with blank password), check the tables in somedb and repair them if an error or warnings are found.

 php myrep.php -r -d somedb
The same as above but will only repair tables with errors (no repair just for warnings)

 php myrep.php -n -r -d somedb
Repair all tables in somedb without checking status first

Download

Latest Version (.tar.gz format)

Latest Version (.zip format)

View Source Code Online



-- © Copyright 2008 Dave Cutting, all rights reserved. GNU GPL v3 Licenced.