Shell Scripting for MySQL Administration: An Introduction

Bob Burgess (Radian6 Technologies)
Average rating: ****.
(4.00, 6 ratings)

This presentation, aimed at a beginning MySQL DBA with little shell scripting experience, is given in three sections: Bash shell introduction, MySQL interface methods, and practical examples.

The Bash Shell is covered in enough detail to let the viewer understand the rest of the presentation and compose scripts of their own. Topics include:

  • Variables
  • Parameters
  • Special Bash Built-In Variables
  • Tests
  • Flow Control
  • File Redirection
  • Common Utilities such as hostname, tr, cut, ls, read, nail, sed, etc.

Interfacing to MySQL is covered:

  • Mysql command-line parameters as applied to scripts
  • Techniques for retrieving a single data value
  • Techniques for iterating through a whole result set
  • Techniques for moving data around, under script control
  • Best practices for security (when calling MySQL)

Practical Examples taken directly from our extensive script library are presented. They will be described in detail and cover the topics of:

  • Monitoring database status variables
  • Monitoring/controlling replication
  • Monitoring performance
  • Alarming and alarm emails/pages
  • Controlling backup
  • Monitoring environment metrics such as disk space
Photo of Bob Burgess

Bob Burgess

Radian6 Technologies

Bob has been squeezing every drop out of MySQL for a little over a year, having previously spent several years roaming in the Garden of Oracle. Last year, he found himself suddenly (and without warning) responsible for storing and retrieving all the information amassed at Radian6, the social media monitoring company.

Comments on this page are now closed.

Comments

Picture of J.B. Wheatley
05/01/2009 12:17pm PDT

Hi. The slides are now available for download via the Presentation link.

Elizabeth Braunstein
05/01/2009 12:12pm PDT

Hi Bob, i found your presentation very interesting and helpful in administering mysql. Could you please post your slides and the scripts for us to look at them one more time? thanks,

04/27/2009 9:56am PDT

Hi Bob,

Appreciated your presentation. I write related scripts; always thought I did this in a pre-historic fashion. (Linux/Cygwin Scripting) A lot of what you referred to related to somthings I do. You had a few I can tweak with though! Was looking for your slides. Please let me know if you posted somewhere, as I cannot find them from your links herein. Thanks

Picture of Timothy Heaney
Timothy Heaney
04/26/2009 1:47pm PDT

Yes, but apparently nail is called mailx now as well. Folks who already have Heirloom mailx don’t need to get nail. Of course, folks who have another mailx may get confused. Perhaps it would be worth mentioning on your slides.

Picture of Bob Burgess
04/26/2009 8:00am PDT

Yes, mailx works well for sending email without attachments from the currently-logged-in user (often “root”). Nail is useful when you want to attach files (such as reports or large logs) and send “from” another user (ie. “monitor” instead of “root”).

Picture of Timothy Heaney
Timothy Heaney
04/26/2009 7:50am PDT

Folks looking for the nail command might wish to alias mailx instead.

Picture of Bob Burgess
04/22/2009 9:04pm PDT

Thanks to everyone who attended. The slides will be available here (today or tomorrow) and also at www.radian6.com/mysql in a few days. A few days after that, I’ll have full example bash scripts available there also.

Co-presented By:

O'Reilly Media MySQL/Sun Microsystems
  • Kickfire
  • Virident
  • Infobright, Inc
  • JasperSoft
  • Intel
  • Advanced Micro Devices
  • BIRT Exchange by Actuate
  • Calpont
  • Canonical
  • Continuent
  • Dolphin Interconnect Solutions
  • Facebook
  • HiT Software, Inc.
  • IBM
  • iDashboards
  • Oracle
  • Pentaho
  • R1Soft
  • Schooner Information Technology
  • SQLstream
  • Ticketmaster
  • Zmanda, Inc.
  • Linux Journal

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at the conference, contact Sharon Cordesse at scordesse@oreilly.com

Download the MySQL Sponsor/Exhibitor Prospectus

Media Partner Opportunities

Download the Media & Promotional Partner Brochure (PDF) for information on trade opportunities with O'Reilly conferences or contact mediapartners@ oreilly.com

Press and Media

For media-related inquiries, contact Maureen Jennings at maureen@oreilly.com

MySQL Conference Newsletter

To stay abreast of conference news and to receive email notification when registration opens, please sign up for the MySQL Conference newsletter.

Contact Us

View a complete list of MySQL contacts.