MySQL Workbench Utilities – Administer MySQL with Python Scripts

Over the next few months, I am going to be writing about the MySQL Utilities, and I will be posting links to each individual blog on this page.

If you haven’t heard of the MySQL Utilities (from the introduction to MySQL Utilities page):

“MySQL Utilities is a package of utilities that are used for maintenance and administration of MySQL servers. These utilities encapsulate a set of primitive commands, and bundles them so they can be used to perform macro operations with a single command. MySQL Utilities may be installed via MySQL Workbench, or as a standalone package. The utilities are written in Python, available under the GPLv2 license, and are extendable using the supplied library. They are designed to work with Python 2.x greater than 2.6.”

If you don’t have Workbench, you may download the MySQL Utility scripts from launchpad.net. You will also need to install Python and to make sure that your execution $PATH’s are set correctly.

The MySQL Utilities are maintained by Chuck Bell. You may find more information about MySQL Utilities on his web site..

To start the MySQL Utilities, from within MySQL Workbench, simply click on the “MySQL Utilities” icon located in the top right area of the home window.

Or, from the MySQL Workbench Plugins menu, select “Start Shell for MySQL Utilities”.

When you open MySQL Utilities, you should be taken to a terminal window, with a list of all of the utilities that are available.

As long as you have your $PATH set correctly, you can just run the scripts from any terminal window and in cron jobs.

Here is a list of the available utilities, with a link to the manual page and a link to my blog about that page (if I have written a post about that utility).

Blog Post Link Script Name & Man Page Description
MySQL Utilities Overview Brief overview of command-line utilities
mut MySQL Utilities Testing
mysqldbcompare Compare Two Databases and Identify Differences
mysqldbcopy Copy Database Objects Between Servers
mysqldbexport Export Object Definitions or Data from a Database
mysqldbimport Import Object Definitions or Data into a Database
mysqldiff Identify Differences Among Database Objects
mysqldiskusage Show Database Disk Usage
Blog mysqlfailover Automatic replication health monitoring and failover
mysqlindexcheck Identify Potentially Redundant Table Indexes
mysqlmetagrep Search Database Object Definitions
mysqlprocgrep Search Server Process Lists
mysqlreplicate Set Up and Start Replication Between Two Servers
mysqlrpladmin Administration utility for MySQL replication
mysqlrplcheck Check Replication Prerequisites
mysqlrplshow Show Slaves for Master Server
mysqlserverclone Clone Existing Server to Create New Server
mysqlserverinfo Display Common Diagnostic Information from a Server
Blog mysqluserclone Clone Existing User to Create New User

 

Tony Darnell is a Principal Sales Consultant for MySQL, a division of Oracle, Inc. MySQL is the world’s most popular open-source database program. Tony may be reached at info [at] ScriptingMySQL.com and on LinkedIn.