- mysqlmon – counters monitor
- mysqltrxmon – transaction monitor
- mysqlping – continuous pinger
- mysql_vars.sh – variable display
- mysql_varmon.sh – variable monitor
- mysql_grants.sh
- schema_cleaner.php – schema file reducer
- schema_summary.php – schema file info extractor
- schema_splitter.php
- table_bench/table_bench.php – insert timer
- table_sizer.php
Display important MySQL server variables and counters.
Uses Bash for server portability.
Output can be easily be diffed to compare servers.
chmod 744 mysql_vars.sh
./mysql_vars.sh
– prompts for host, username, and password (not echoed) of the MySQL server.
On Windows, via a PuTTY connection, the script output may exceed PuTTY's scrollback limit. I chose an interactive connection input for my usage on Linux-to-Linux machines (avoiding switches). Nevertheless, this means that stdout redirection is blocked.
Short of rewriting the command-line parsing, a workaround is:
./mysql_vars.sh | tee myvars.txt
Continously monitor MySQL server variables.
Uses Bash for server portability and updating ease (but possesses a flickery terminal refresh).
This directly led to mysqlmon.
chmod 744 mysql_varmon.sh
./mysql_varmon.sh
– prompts for host, username, and password (not echoed) of the MySQL server.
Ctrl + C to exit.
List GRANTs.
Similar to pt-show-grants, with cleaner output.
Connect as root user.
chmod 744 mysql_grants.sh
./mysql_grants.sh
PHP CLI script to reduce large schema files to just table definitions i.e. removing mysqldump comments and directives.
php schema_tools/schema_cleaner.php <filename>
PHP CLI script to extract a brief summary of table names and foreign keys from large unwieldy schema files.
The keyword option enables searching for keywords in table names and table contents.
php schema_tools/schema_summary.php <filename> [keyword]
Example for querying a large schema file for user references in table names and columns:
php schema_tools/schema_summary.php bigschema.sql user | less
PHP CLI script to split a large MySQL schema file by table definitions into separate .sql files.
php schema_tools/schema_splitter.php <filename>
example:
php schema_tools/schema_splitter.php ../schema_example/dbfilltest.sql
- Time row inserts into a MySQL table through configuration toggles controlling transactions, prepared statements etc.
- Provides a timing harness for altering mysqld variables.
Timings are often highly variable, and so require much averaging. Nevertheless, large time differences are noticeable for prepared statements and my.cnf variables adjusted for INSERTs.
-
cd table_bench
-
Set the database connection parameters in setup.php
-
php setup.php
-
Set the parameters in table_bench/config.php
-
php table_bench.php
The above PHP files can also be executed through a web server.
PHP CLI script to query MySQL table size properties, and if timestamps are available, provide an estimation of data insertion rates.
First, add the database connection and table parameters in the configuration section at the top of the script.
php table_sizer.php
or if made executable:
./table_sizer.php
Scripts and executables released under the GPL v.3.