SlideShare a Scribd company logo
MySQL UtilitiesMySQL Utilities
Dave Stokes
MySQL Community Manager
Email: David.Stokes@Oracle.com
Twiter: @Stoker
Slides: slideshare.net/davidmstokes
Safe Harbor Agreement
The following is intended to outline our general product
direction. It is intended for information purposes only, and
may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality,
and should not be relied upon in making purchasing
decision. The development, release, and timing of any
features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.
So take anything on future
products with a grain of
Happy Birthday to MySQL
MySQL 5.7
● http://www.thecompletelistoffeatures.com/
● 150 new features
– Native JSON data type
– Group Replication
– Replication
● Multi source
● Parallel within database
– Secure by default install
– GIS Support
Group Replication MySQL 5.7
Quick Look At MySQL Utilities
Download &
Documentation
● https://dev.mysql.com/downloads/utilities/
● http://dev.mysql.com/doc/mysql-
utilities/1.5/en/
What are they?
● It 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.
● 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 versions 2.6 or later and there is no support
(yet) for Python v3.1.
What are they?
● MySQL Utilities is both a set of command-
line utilities as well as a Python library for
making the common tasks easy to
accomplish. The library is written entirely in
Python, meaning that it is not necessary to
have any other tools or libraries installed to
make it work. It is currently designed to work
with Python v2.6 or later and there is no
support (yet) for Python v3.1.
Prerequisites
● MySQL Utilities requires Python 2.6. All of
the Python code is written to conform to this
version of Python.
● For connecting to MySQL, MySQL Utilities
requires a MySQL Connector/Python
General Availability (GA) release (version
2.0.4/2.1.2 or later). If you do not have
Connector/Python installed get it at
http://dev.mysql.com/downloads/connector/p
ython/
Install
● Source Code
– shell> unzip mysql-utilities-1.5.6.zip
– shell> cd mysql-utilities-1.5.6
– shell> python ./setup.py build
– shell> sudo python ./setup.py install
Install
● Oracle Linux and Red Hat Linux 6
– sudo rpm -i mysql-utilities-1.5.6-el6.noarch.rpm
● Debian Linux
– sudo dpkg -i mysql-utilities-1.5.6-debian6.0_all.deb
● OS X
– The .dmg file available for OS X is built for x84-64 bit
platforms, and supports OS X version 10.7 (Lion) and newer.
After you download the .dmg file, install MySQL Utilities by
opening it and double clicking the .pkg file.
Install
● Microsoft Windows
– MySQL Installer: Download and execute the MySQL
Installer MSI file. Select the MySQL Utilities product
and then proceed with the installation. This is the
recommended approach, and it will also
automatically select and install the required
prerequisites. See the MySQL Installer manual for
additional details.
– Standalone: Download and execute the MySQL
Utilities standalone MSI file.
Overview
● Database Operations
● General Operations
● High Availability Operations
● Server Operations
● Specialized Operations
Database Operations
● mysqldbcompare
– Compare databases on two servers
or the same server
– Compare definitions and data
– Generate a difference report
– Generate SQL transformation
statements
● mysqldbcopy
– Copy databases between servers
– Clone databases on the same server
– Supports rename
● mysqldbexport
– Export metadata and/or data from one
or more databases
– Formats: SQL, CSV, TAB, Grid, Vertical
● mysqldbimport
– Import metadata and data from one or
more files
– Reads all formats from mysqldbexport
● mysqldiff
– Compare object definitions
– Generate a difference report
General Operations
●
mysqldiskusage
– Show disk usage for databases
– Generate reports in SQL, CSV, TAB, Grid, Vertical
● mysqlfrm
– Reads .frm files, optionally in byte-by-byte
diagnostic mode
– Generates CREATE statements from table
definition data
● mysqlindexcheck
– Read indexes for one or more tables
– Check for redundant and duplicate indexes
– Generate reports in SQL, CSV, TAB, Grid, Vertical
●
mysqlmetagrep
– Search metadata
– Regexp, database search
– Generate SQL statement for search query
● mysqlprocgrep
– Search process information
– Generate SQL statement for search
– Kill processes that match query
●
mysqluserclone
– Clone a user account, to the same or different server
– Show user grants
●
mysqluc
– Command line client for running MySQL Utilities
– Allows a persistent connection to a MySQL Server
– Tab completion for utility names and options
– Allows calling the commands with shorter names,
such as using "serverinfo" instead of mysqlserverinfo
High Availability Operations
● mysqlfailover
– Provides automatic failover on a replication
topology
– Uses Global Transaction Identifiers (GTID,
MySQL Server 5.6.5+)
●
mysqlreplicate
– Setup replication
– Start from beginning, current, specific binlog, pos
●
mysqlrplms
– Provides round-robin multi-source replication (a
slave server continually cycles through multiple
masters in order to store a consolidated data set)
– Uses Global Transaction Identifiers (GTID,
MySQL Server 5.6.9+)
● mysqlrpladmin
– Administers the replication topology
– Allows recovery of the master
– Commands include elect, failover, gtid, health,
start, stop, and switchover
● mysqlrplcheck
– Check replication configuration
– Tests binary logging on master
● mysqlrplshow
– Show slaves attached to master
– Can search recursively
– Show the replication topology as a graph or list
● mysqlrplsync
– Check data consistency between servers in a
replicated setup
– Uses Global Transaction Identifiers (GTID)
– Requires MySQL Server 5.6.14 and higher
Server Operations
● mysqlserverclone
– Start a new instance of a running server
● mysqlserverinfo
– Show server information
– Can search for running servers on a host
– Access online or offline servers
Specialized Operations
These utilities are designed to be used with a specific commercial
extension. In this case, these utilities require the Audit Log Plugin
(Comes with support contract) .
●
mysqlauditadmin
– Monitor the audit log
– Copy, rotate, and configure the audit log
●
mysqlauditgrep
– Search the audit log
– Output results to different formats
mysqldbcopy
shell> mysqldbcopy --source=root@localhost:3310 
--destination=root@localhost:3311 test123 --rpl=master 
--rpl-user=rpl
# Source on localhost: ... connected.
# Destination on localhost: ... connected.
# Source on localhost: ... connected.
# Stopping slave
# Copying database test123
# Copying TABLE test123.t1
# Copying data for TABLE test123.t1
# Connecting to the current server as master
# Starting slave
#...done.
mysqlprocgrep
Kill all queries created by user john that are less than 1 minute:
shell> mysqlprocgrep --server=root@localhost 
--match-user=john --age=-1m --kill-query
Kill all connections that have been idle for more than 1 hour:
shell> mysqlprocgrep --server=root@localhost 
--match-command=sleep --age=1h --kill-connection
mysqlrplcheck
shell> mysqlrplsync --master=user:pass@localhost:3310 
--slaves=rpl:pass@localhost:3311,rpl:pass@localhost:3312
#
# GTID differences between Master and Slaves:
# - Slave 'localhost@3311' is 15 transactions behind Master.
# - Slave 'localhost@3312' is 12 transactions behind Master.
#
# Checking data consistency.
#
# Using Master 'localhost@3310' as base server for comparison.
# Checking 'test_rplsync_db' database...
# - Checking 't0' table data...
# [OK] `test_rplsync_db`.`t0` checksum for server 'localhost@3311'.
# [OK] `test_rplsync_db`.`t0` checksum for server 'localhost@3312'.
# - Checking 't1' table data...
# [OK] `test_rplsync_db`.`t1` checksum for server 'localhost@3311'.
# [OK] `test_rplsync_db`.`t1` checksum for server 'localhost@3312'.
# Checking 'test_db' database...
# - Checking 't0' table data...
# [OK] `test_db`.`t0` checksum for server 'localhost@3311'.
# [OK] `test_db`.`t0` checksum for server 'localhost@3312'.
# - Checking 't1' table data...
# [OK] `test_db`.`t1` checksum for server 'localhost@3311'.
# [OK] `test_db`.`t1` checksum for server 'localhost@3312'.
#
#...done.
#
# SUMMARY: No data consistency issue found.
mysqlserverclone
shell> mkdir /source/test123
shell> mysqlserverclone --server=root:pass@localhost 
--new-data=/Users/cbell/source/test123 --new-port=3310 
--root-password=pass --mysqld=--log-bin=mysql-bin
# Cloning the MySQL server running on localhost.
# Creating new data directory...
# Configuring new instance...
# Locating mysql tools...
# Setting up empty database and mysql tables...
# Starting new instance of the server...
# Testing connection to new instance...
# Success!
# Setting the root password...
# ...done.
MySQL Fabric
● MySQL Fabric is a system for managing a farm of MySQL servers. MySQL
Fabric provides an extensible and easy to use system for managing a MySQL
deployment for sharding and high-availability.
● Fabric organizes servers in groups (called high-availability groups) for
managing different shards or simply for providing high availability. For example,
if standard asynchronous replication is in use, Fabric may be configured to
automatically monitor the status of servers in a group. If the current master in a
group fails, it elects a new one if a server in the group can become a master.
● Besides the high-availability operations such as failover and switchover, Fabric
also permits shard operations such as shard creation and removal.
● Fabric is written in Python and includes a special library that implements all
of the functionality provided. To interact with Fabric, a special utility named
mysqlfabric provides a set of commands you can use to create and manage
groups, define and manipulate sharding, and much more.
MySQL Fabric
● Does my application need to do
anything as part of the failover?
● No. The failover is transparent to
the application as the Fabric-aware
connectors will automatically start
routing transactions and queries
based on the new server topology.
The application does need to
handle the failure of a number of
transactions when the Primary has
failed but before the new Primary is
in place but this should be
considered part of normal MySQL
error handling.
MySQL Router
● Connection mutliplexing
● Traffic splitter
● Minimizing aborts for Group Replication
● Connection load balancing
● Static routing
● Fabric support for non-Fabric aware
connectors
MySQL Workbench
● Query tool
– Visual Explain to aid in optimization
●
Admin tool
– Users, backup, imports, change settings
– No more fat finger 'UPDATE user set 'SELECT_PRIV='Y',....
●
Dashboard and System Monitoring
– Sys Schema
●
Entity Relationship Mapper
– Great tool for investigating new schemas
– Print schema for documentation
●
Migration tool
●
And more!
Q&A
● Slides: slideshare.net/davidmstokes
● Twitter: @Stoker
● Email: David.Stokes@Oracle.com
● Blog: OpenSourceDBA.wordpress.com

More Related Content

PDF
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
PDF
PNWPHP -- What are Databases so &#%-ing Difficult
PDF
Ohio Linux Fest -- MySQL's NoSQL
PDF
MySQL Performance Best Practices
PDF
My sql 5.6&MySQL Cluster 7.3
PDF
MySQL Replication Update - DEbconf 2020 presentation
PDF
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
PDF
MySQL Server Defaults
MySQL's NoSQL -- Texas Linuxfest August 22nd 2015
PNWPHP -- What are Databases so &#%-ing Difficult
Ohio Linux Fest -- MySQL's NoSQL
MySQL Performance Best Practices
My sql 5.6&MySQL Cluster 7.3
MySQL Replication Update - DEbconf 2020 presentation
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL Server Defaults

What's hot (20)

PPTX
Confoo 2021 -- MySQL New Features
PPTX
MySQL Utilities -- Cool Tools For You: PHP World Nov 16 2016
PDF
Scaling MySQl 1 to N Servers -- Los Angelese MySQL User Group Feb 2014
PDF
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
PDF
MySql's NoSQL -- best of both worlds on the same disks
PDF
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
PDF
New awesome features in MySQL 5.7
PDF
MySQL 5.7 -- SCaLE Feb 2014
PDF
Open Source World June '21 -- JSON Within a Relational Database
PDF
Php & my sql - how do pdo, mysq-li, and x devapi do what they do
PDF
MySQL 5.7 in a Nutshell
PDF
MySQL JSON Functions
PDF
Midwest PHP Presentation - New MSQL Features
PDF
InnoDB Tablespace Encryption
PDF
My sql 5.7-upcoming-changes-v2
PDF
MySQL Document Store for Modern Applications
PDF
Tx lf propercareandfeedmysql
PDF
FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-...
PPTX
Proxysql use case scenarios fosdem17
PDF
MySQL 8.0 Operational Changes
Confoo 2021 -- MySQL New Features
MySQL Utilities -- Cool Tools For You: PHP World Nov 16 2016
Scaling MySQl 1 to N Servers -- Los Angelese MySQL User Group Feb 2014
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySql's NoSQL -- best of both worlds on the same disks
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
New awesome features in MySQL 5.7
MySQL 5.7 -- SCaLE Feb 2014
Open Source World June '21 -- JSON Within a Relational Database
Php & my sql - how do pdo, mysq-li, and x devapi do what they do
MySQL 5.7 in a Nutshell
MySQL JSON Functions
Midwest PHP Presentation - New MSQL Features
InnoDB Tablespace Encryption
My sql 5.7-upcoming-changes-v2
MySQL Document Store for Modern Applications
Tx lf propercareandfeedmysql
FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-...
Proxysql use case scenarios fosdem17
MySQL 8.0 Operational Changes
Ad

Viewers also liked (20)

PDF
MySQL Schema Maintenance
PPTX
Ansible for large scale deployment
PPT
My two cents about Mysql backup
PPTX
Rakuten New MySQL Backup System With Xtrabackup
ODP
Vernieuwde acl 1
PDF
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
PDF
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
PDF
MySQL's NoSQL -- SCaLE 13x Feb. 20, 2015
PDF
MySQL 5.7 Tutorial Dutch PHP Conference 2015
PDF
SQL For PHP Programmers
PDF
RMOUG MySQL 5.7 New Features
PDF
MySQL's new Secure by Default Install -- All Things Open October 20th 2015
PDF
Triangle MySQL User Group MySQL Fabric Presentation Feb 12th, 2015
PDF
SQL For Programmers -- Boston Big Data Techcon April 27th
ODP
Linux command-line-magic-jdnl15
PDF
MySQL Workbench for DFW Unix Users Group
PDF
SkiPHP -- Database Basics for PHP
PPTX
MySQL Replication Alternative: Pros and Cons
PDF
MySQL 5.7. Tutorial - Dutch PHP Conference 2015
PPTX
Git basics
MySQL Schema Maintenance
Ansible for large scale deployment
My two cents about Mysql backup
Rakuten New MySQL Backup System With Xtrabackup
Vernieuwde acl 1
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
MySQL's NoSQL -- SCaLE 13x Feb. 20, 2015
MySQL 5.7 Tutorial Dutch PHP Conference 2015
SQL For PHP Programmers
RMOUG MySQL 5.7 New Features
MySQL's new Secure by Default Install -- All Things Open October 20th 2015
Triangle MySQL User Group MySQL Fabric Presentation Feb 12th, 2015
SQL For Programmers -- Boston Big Data Techcon April 27th
Linux command-line-magic-jdnl15
MySQL Workbench for DFW Unix Users Group
SkiPHP -- Database Basics for PHP
MySQL Replication Alternative: Pros and Cons
MySQL 5.7. Tutorial - Dutch PHP Conference 2015
Git basics
Ad

Similar to MySQL Utilities -- PyTexas 2015 (20)

PDF
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
PPTX
ProxySQL for MySQL
PDF
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
PPT
MySQL Cluster Basics
PDF
MySQL database replication
PDF
MySQL up and running 30 minutes.pdf
ODP
MySQL 101 PHPTek 2017
PDF
Securing your MySQL / MariaDB Server data
PDF
Whitepaper MS SQL Server on Linux
PDF
The Accidental DBA
PDF
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
PDF
A3Sec Advanced Deployment System
Β 
PPTX
High performance and high availability proxies for MySQL
PDF
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
PDF
My SQL 101
PDF
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
PDF
Ansible is Our Wishbone
PDF
BITS: Introduction to MySQL - Introduction and Installation
Β 
PDF
Curso de MySQL 5.7
PPTX
PowerShellForDBDevelopers
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
ProxySQL for MySQL
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
MySQL Cluster Basics
MySQL database replication
MySQL up and running 30 minutes.pdf
MySQL 101 PHPTek 2017
Securing your MySQL / MariaDB Server data
Whitepaper MS SQL Server on Linux
The Accidental DBA
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
A3Sec Advanced Deployment System
Β 
High performance and high availability proxies for MySQL
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
My SQL 101
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone
BITS: Introduction to MySQL - Introduction and Installation
Β 
Curso de MySQL 5.7
PowerShellForDBDevelopers

More from Dave Stokes (20)

PDF
Valkey 101 - SCaLE 22x March 2025 Stokes.pdf
PPTX
Locking Down Your MySQL Database.pptx
PPTX
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
PDF
MySQL Indexes and Histograms - RMOUG Training Days 2022
PDF
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
PDF
Windowing Functions - Little Rock Tech fest 2019
PDF
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
PPTX
Develop PHP Applications with MySQL X DevAPI
PDF
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
PDF
The Proper Care and Feeding of MySQL Databases
PDF
MySQL without the SQL -- Cascadia PHP
PDF
MySQL 8 Server Optimization Swanseacon 2018
PDF
MySQL Without The SQL -- Oh My! PHP[Tek] June 2018
PDF
Presentation Skills for Open Source Folks
PPTX
MySQL Without the SQL -- Oh My! Longhorn PHP Conference
PPTX
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
PPTX
ConFoo MySQL Replication Evolution : From Simple to Group Replication
PDF
Advanced MySQL Query Optimizations
PPTX
Making MySQL Agile-ish
PPTX
PHP Database Programming Basics -- Northeast PHP
Valkey 101 - SCaLE 22x March 2025 Stokes.pdf
Locking Down Your MySQL Database.pptx
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
MySQL Indexes and Histograms - RMOUG Training Days 2022
MySQL 8.0 Features -- Oracle CodeOne 2019, All Things Open 2019
Windowing Functions - Little Rock Tech fest 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
Develop PHP Applications with MySQL X DevAPI
MySQL 8 Tips and Tricks from Symfony USA 2018, San Francisco
The Proper Care and Feeding of MySQL Databases
MySQL without the SQL -- Cascadia PHP
MySQL 8 Server Optimization Swanseacon 2018
MySQL Without The SQL -- Oh My! PHP[Tek] June 2018
Presentation Skills for Open Source Folks
MySQL Without the SQL -- Oh My! Longhorn PHP Conference
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
ConFoo MySQL Replication Evolution : From Simple to Group Replication
Advanced MySQL Query Optimizations
Making MySQL Agile-ish
PHP Database Programming Basics -- Northeast PHP

Recently uploaded (20)

PPTX
Internet___Basics___Styled_ presentation
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PPTX
artificial intelligence overview of it and more
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PPTX
E -tech empowerment technologies PowerPoint
DOCX
Unit-3 cyber security network security of internet system
PDF
The Internet -By the Numbers, Sri Lanka Edition
Β 
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
presentation_pfe-universite-molay-seltan.pptx
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
Digital Literacy And Online Safety on internet
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PDF
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
Internet___Basics___Styled_ presentation
introduction about ICD -10 & ICD-11 ppt.pptx
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
artificial intelligence overview of it and more
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
Job_Card_System_Styled_lorem_ipsum_.pptx
E -tech empowerment technologies PowerPoint
Unit-3 cyber security network security of internet system
The Internet -By the Numbers, Sri Lanka Edition
Β 
Tenda Login Guide: Access Your Router in 5 Easy Steps
presentation_pfe-universite-molay-seltan.pptx
Decoding a Decade: 10 Years of Applied CTI Discipline
Introuction about ICD -10 and ICD-11 PPT.pptx
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Cloud-Scale Log Monitoring _ Datadog.pdf
SAP Ariba Sourcing PPT for learning material
Digital Literacy And Online Safety on internet
An introduction to the IFRS (ISSB) Stndards.pdf
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
PptxGenJS_Demo_Chart_20250317130215833.pptx

MySQL Utilities -- PyTexas 2015

  • 1. MySQL UtilitiesMySQL Utilities Dave Stokes MySQL Community Manager Email: David.Stokes@Oracle.com Twiter: @Stoker Slides: slideshare.net/davidmstokes
  • 2. Safe Harbor Agreement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decision. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  • 3. So take anything on future products with a grain of
  • 5. MySQL 5.7 ● http://www.thecompletelistoffeatures.com/ ● 150 new features – Native JSON data type – Group Replication – Replication ● Multi source ● Parallel within database – Secure by default install – GIS Support
  • 7. Quick Look At MySQL Utilities
  • 8. Download & Documentation ● https://dev.mysql.com/downloads/utilities/ ● http://dev.mysql.com/doc/mysql- utilities/1.5/en/
  • 9. What are they? ● It 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. ● 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 versions 2.6 or later and there is no support (yet) for Python v3.1.
  • 10. What are they? ● MySQL Utilities is both a set of command- line utilities as well as a Python library for making the common tasks easy to accomplish. The library is written entirely in Python, meaning that it is not necessary to have any other tools or libraries installed to make it work. It is currently designed to work with Python v2.6 or later and there is no support (yet) for Python v3.1.
  • 11. Prerequisites ● MySQL Utilities requires Python 2.6. All of the Python code is written to conform to this version of Python. ● For connecting to MySQL, MySQL Utilities requires a MySQL Connector/Python General Availability (GA) release (version 2.0.4/2.1.2 or later). If you do not have Connector/Python installed get it at http://dev.mysql.com/downloads/connector/p ython/
  • 12. Install ● Source Code – shell> unzip mysql-utilities-1.5.6.zip – shell> cd mysql-utilities-1.5.6 – shell> python ./setup.py build – shell> sudo python ./setup.py install
  • 13. Install ● Oracle Linux and Red Hat Linux 6 – sudo rpm -i mysql-utilities-1.5.6-el6.noarch.rpm ● Debian Linux – sudo dpkg -i mysql-utilities-1.5.6-debian6.0_all.deb ● OS X – The .dmg file available for OS X is built for x84-64 bit platforms, and supports OS X version 10.7 (Lion) and newer. After you download the .dmg file, install MySQL Utilities by opening it and double clicking the .pkg file.
  • 14. Install ● Microsoft Windows – MySQL Installer: Download and execute the MySQL Installer MSI file. Select the MySQL Utilities product and then proceed with the installation. This is the recommended approach, and it will also automatically select and install the required prerequisites. See the MySQL Installer manual for additional details. – Standalone: Download and execute the MySQL Utilities standalone MSI file.
  • 15. Overview ● Database Operations ● General Operations ● High Availability Operations ● Server Operations ● Specialized Operations
  • 16. Database Operations ● mysqldbcompare – Compare databases on two servers or the same server – Compare definitions and data – Generate a difference report – Generate SQL transformation statements ● mysqldbcopy – Copy databases between servers – Clone databases on the same server – Supports rename ● mysqldbexport – Export metadata and/or data from one or more databases – Formats: SQL, CSV, TAB, Grid, Vertical ● mysqldbimport – Import metadata and data from one or more files – Reads all formats from mysqldbexport ● mysqldiff – Compare object definitions – Generate a difference report
  • 17. General Operations ● mysqldiskusage – Show disk usage for databases – Generate reports in SQL, CSV, TAB, Grid, Vertical ● mysqlfrm – Reads .frm files, optionally in byte-by-byte diagnostic mode – Generates CREATE statements from table definition data ● mysqlindexcheck – Read indexes for one or more tables – Check for redundant and duplicate indexes – Generate reports in SQL, CSV, TAB, Grid, Vertical ● mysqlmetagrep – Search metadata – Regexp, database search – Generate SQL statement for search query ● mysqlprocgrep – Search process information – Generate SQL statement for search – Kill processes that match query ● mysqluserclone – Clone a user account, to the same or different server – Show user grants ● mysqluc – Command line client for running MySQL Utilities – Allows a persistent connection to a MySQL Server – Tab completion for utility names and options – Allows calling the commands with shorter names, such as using "serverinfo" instead of mysqlserverinfo
  • 18. High Availability Operations ● mysqlfailover – Provides automatic failover on a replication topology – Uses Global Transaction Identifiers (GTID, MySQL Server 5.6.5+) ● mysqlreplicate – Setup replication – Start from beginning, current, specific binlog, pos ● mysqlrplms – Provides round-robin multi-source replication (a slave server continually cycles through multiple masters in order to store a consolidated data set) – Uses Global Transaction Identifiers (GTID, MySQL Server 5.6.9+) ● mysqlrpladmin – Administers the replication topology – Allows recovery of the master – Commands include elect, failover, gtid, health, start, stop, and switchover ● mysqlrplcheck – Check replication configuration – Tests binary logging on master ● mysqlrplshow – Show slaves attached to master – Can search recursively – Show the replication topology as a graph or list ● mysqlrplsync – Check data consistency between servers in a replicated setup – Uses Global Transaction Identifiers (GTID) – Requires MySQL Server 5.6.14 and higher
  • 19. Server Operations ● mysqlserverclone – Start a new instance of a running server ● mysqlserverinfo – Show server information – Can search for running servers on a host – Access online or offline servers
  • 20. Specialized Operations These utilities are designed to be used with a specific commercial extension. In this case, these utilities require the Audit Log Plugin (Comes with support contract) . ● mysqlauditadmin – Monitor the audit log – Copy, rotate, and configure the audit log ● mysqlauditgrep – Search the audit log – Output results to different formats
  • 21. mysqldbcopy shell> mysqldbcopy --source=root@localhost:3310 --destination=root@localhost:3311 test123 --rpl=master --rpl-user=rpl # Source on localhost: ... connected. # Destination on localhost: ... connected. # Source on localhost: ... connected. # Stopping slave # Copying database test123 # Copying TABLE test123.t1 # Copying data for TABLE test123.t1 # Connecting to the current server as master # Starting slave #...done.
  • 22. mysqlprocgrep Kill all queries created by user john that are less than 1 minute: shell> mysqlprocgrep --server=root@localhost --match-user=john --age=-1m --kill-query Kill all connections that have been idle for more than 1 hour: shell> mysqlprocgrep --server=root@localhost --match-command=sleep --age=1h --kill-connection
  • 23. mysqlrplcheck shell> mysqlrplsync --master=user:pass@localhost:3310 --slaves=rpl:pass@localhost:3311,rpl:pass@localhost:3312 # # GTID differences between Master and Slaves: # - Slave 'localhost@3311' is 15 transactions behind Master. # - Slave 'localhost@3312' is 12 transactions behind Master. # # Checking data consistency. # # Using Master 'localhost@3310' as base server for comparison. # Checking 'test_rplsync_db' database... # - Checking 't0' table data... # [OK] `test_rplsync_db`.`t0` checksum for server 'localhost@3311'. # [OK] `test_rplsync_db`.`t0` checksum for server 'localhost@3312'. # - Checking 't1' table data... # [OK] `test_rplsync_db`.`t1` checksum for server 'localhost@3311'. # [OK] `test_rplsync_db`.`t1` checksum for server 'localhost@3312'. # Checking 'test_db' database... # - Checking 't0' table data... # [OK] `test_db`.`t0` checksum for server 'localhost@3311'. # [OK] `test_db`.`t0` checksum for server 'localhost@3312'. # - Checking 't1' table data... # [OK] `test_db`.`t1` checksum for server 'localhost@3311'. # [OK] `test_db`.`t1` checksum for server 'localhost@3312'. # #...done. # # SUMMARY: No data consistency issue found.
  • 24. mysqlserverclone shell> mkdir /source/test123 shell> mysqlserverclone --server=root:pass@localhost --new-data=/Users/cbell/source/test123 --new-port=3310 --root-password=pass --mysqld=--log-bin=mysql-bin # Cloning the MySQL server running on localhost. # Creating new data directory... # Configuring new instance... # Locating mysql tools... # Setting up empty database and mysql tables... # Starting new instance of the server... # Testing connection to new instance... # Success! # Setting the root password... # ...done.
  • 25. MySQL Fabric ● MySQL Fabric is a system for managing a farm of MySQL servers. MySQL Fabric provides an extensible and easy to use system for managing a MySQL deployment for sharding and high-availability. ● Fabric organizes servers in groups (called high-availability groups) for managing different shards or simply for providing high availability. For example, if standard asynchronous replication is in use, Fabric may be configured to automatically monitor the status of servers in a group. If the current master in a group fails, it elects a new one if a server in the group can become a master. ● Besides the high-availability operations such as failover and switchover, Fabric also permits shard operations such as shard creation and removal. ● Fabric is written in Python and includes a special library that implements all of the functionality provided. To interact with Fabric, a special utility named mysqlfabric provides a set of commands you can use to create and manage groups, define and manipulate sharding, and much more.
  • 26. MySQL Fabric ● Does my application need to do anything as part of the failover? ● No. The failover is transparent to the application as the Fabric-aware connectors will automatically start routing transactions and queries based on the new server topology. The application does need to handle the failure of a number of transactions when the Primary has failed but before the new Primary is in place but this should be considered part of normal MySQL error handling.
  • 27. MySQL Router ● Connection mutliplexing ● Traffic splitter ● Minimizing aborts for Group Replication ● Connection load balancing ● Static routing ● Fabric support for non-Fabric aware connectors
  • 28. MySQL Workbench ● Query tool – Visual Explain to aid in optimization ● Admin tool – Users, backup, imports, change settings – No more fat finger 'UPDATE user set 'SELECT_PRIV='Y',.... ● Dashboard and System Monitoring – Sys Schema ● Entity Relationship Mapper – Great tool for investigating new schemas – Print schema for documentation ● Migration tool ● And more!
  • 29. Q&A ● Slides: slideshare.net/davidmstokes ● Twitter: @Stoker ● Email: David.Stokes@Oracle.com ● Blog: OpenSourceDBA.wordpress.com