mysql-utilities-1.3.5/0000755001577100000120000000000012210052300014125 5ustar pb2userwheelmysql-utilities-1.3.5/LICENSE.txt0000644001577100000120000004310312210044364015764 0ustar pb2userwheel GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. mysql-utilities-1.3.5/setup.py0000644001577100000120000002375312210044364015664 0ustar pb2userwheel#!/usr/bin/env python # # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # """Setup script for MySQL Utilities""" from __future__ import absolute_import import os import re from glob import glob import sys import distutils.core from distutils.core import setup from distutils.command.build_scripts import build_scripts as _build_scripts from distutils.command.install import install as _install from distutils.command.install_scripts import \ install_scripts as _install_scripts from distutils.util import change_root from distutils.file_util import DistutilsFileError, write_file from distutils import log, dir_util from info import META_INFO, INSTALL # Check required Python version if sys.version_info[0:2] not in [(2, 6), (2, 7)]: log.error("MySQL Utilities requires Python v2.6 or v2.7") sys.exit(1) COMMANDS = { 'cmdclass': { }, } # Custom bdist_rpm DistUtils command try: from support.dist_rpm import BuiltDistRPM, BuiltCommercialRPM, SourceRPM except ImportError: pass # Use default when not available else: COMMANDS['cmdclass'].update({ 'bdist_rpm': BuiltDistRPM, 'sdist_rpm': SourceRPM, 'bdist_com_rpm': BuiltCommercialRPM }) try: from support.distribution.commands import build, bdist, sdist except ImportError: pass # Use default when not available else: COMMANDS['cmdclass'].update({ 'build': build.Build, 'sdist_com': sdist.SourceCommercial, 'bdist_com': bdist.BuiltCommercial }) try: from support.dist_deb import BuildDistDebian, BuildCommercialDistDebian except ImportError: pass else: COMMANDS['cmdclass'].update({ 'bdist_deb': BuildDistDebian, 'bdist_com_deb': BuildCommercialDistDebian }) ARGS = { } PROFILE_SCRIPT = ''' prepend_path () ( IFS=':' for D in $PATH; do if test x$D != x$1; then OUTPATH="${OUTPATH:+$OUTPATH:}$D" fi done echo "$1:$OUTPATH" ) PATH=`prepend_path %s` ''' class install(_install): """Install MySQL Utilities""" user_options = _install.user_options + [ ("skip-profile", None, "Skip installing a profile script"), ] boolean_options = _install.boolean_options + ['skip-profile'] def initialize_options(self): """Initialize options""" _install.initialize_options(self) self.skip_profile = False def finalize_options(self): """Finalize options""" _install.finalize_options(self) def run(self): _install.run(self) class install_man(distutils.core.Command): description = "Install Unix manual pages" user_options = [ ('prefix=', None, 'installation prefix (default /usr/share/man)'), ('root=', None, "install everything relative to this alternate root directory"), ('record=', None, "filename in which to record list of installed files"), ] def initialize_options(self): """Initialize options""" self.root = None self.prefix = None self.record = None def finalize_options(self): """Finalize options""" self.set_undefined_options('install', ('root', 'root'), ('record', 'record') ) if not self.prefix: self.prefix = '/usr/share/man' if self.root: self.prefix = change_root(self.root, self.prefix) def run(self): """Run the command""" srcdir = os.path.join('docs', 'man') manpages = os.listdir(srcdir) self._outfiles = [] for man in manpages: src_man = os.path.join(srcdir, man) section = os.path.splitext(man)[1][1:] dest_dir = os.path.join(self.prefix, 'man' + section) self.mkpath(dest_dir) # Could be different section dest_man = os.path.join(dest_dir, man) self.copy_file(src_man, dest_man) self._outfiles.append(dest_man) # Disabled, done in the RPM spec #self._write_record() def _write_record(self): """Write list of installed files""" if self.record: outputs = self.get_outputs() if self.root: # strip any package prefix root_len = len(self.root) for counter in xrange(len(outputs)): outputs[counter] = outputs[counter][root_len:] log.info("writing list of installed files to '{0}'".format( self.record)) f = open(self.record, "a") for line in outputs: f.write(line + "\n") def get_outputs(self): return self._outfiles class install_scripts(_install): """Install MySQL Utilities scripts""" description = "Install the Shell Profile (Linux/Unix)" user_options = _install.user_options + [ ('root=', None, "install everything relative to this alternate root directory"), ] boolean_options = _install.boolean_options + ['skip-profile'] profile_filename = 'mysql-utilities.sh' profile_d_dir = '/etc/profile.d/' def initialize_options(self): """initialize options""" _install.initialize_options(self) self.skip_profile = False self.root = None self.install_dir = None def finalize_options(self): """Finalize options""" _install.finalize_options(self) self.set_undefined_options('install', ('install_dir', 'install_dir'), ('root', 'root')) def _create_shell_profile(self): """Creates and installes the shell profile This method will create and try to install the shell profile file under /etc/profile.d/. It will skip this step when the --skip-profile install option has been given, or when the user installing MySQL Utilities has no permission. """ if self.skip_profile: log.info("Not adding shell profile %s (skipped)" % ( os.path.join(self.profile_d_dir, self.profile_filename))) return if self.root: profile_dir = change_root(self.root, self.profile_d_dir) else: profile_dir = self.profile_d_dir try: dir_util.mkpath(profile_dir) except DistutilsFileError as err: log.info("Not installing mysql-utilities.sh: {0}".format(err)) self.skip_profile = True return destfile = os.path.join(profile_dir, self.profile_filename) if not os.access(os.path.dirname(destfile), os.X_OK | os.W_OK): log.info("Not installing mysql-utilities.sh in " "{folder} (no permission)".format(folder=destfile)) self.skip_profile = True return if os.path.exists(os.path.dirname(destfile)): if os.path.isdir(destfile) and not os.path.islink(destfile): dir_util.remove_tree(destfile) elif os.path.exists(destfile): log.info("Removing {filename}".format(filename=destfile)) os.unlink(destfile) script = PROFILE_SCRIPT % (self.install_dir,) log.info("Writing {filename}".format(filename=destfile)) open(destfile, "w+").write(script) def run(self): """Run the command""" self._create_shell_profile() def get_outputs(self): """Get installed files""" outputs = _install.get_outputs(self) return outputs class build_scripts(_build_scripts): """Class for providing a customized version of build_scripts. When ``run`` is called, this command class will: 1. Create a copy of all ``.py`` files in the **scripts** option that does not have the ``.py`` extension. 2. Replace the list in the **scripts** attribute with a list consisting of the script files with the ``.py`` extension removed. 3. Call run method in `distutils.command.build_scripts`. 4. Restore the scripts list to the old value, for other commands to use.""" def run(self): if not self.scripts: return saved_scripts = self.scripts self.scripts = [] for script in saved_scripts: script = distutils.util.convert_path(script) script_copy, script_ext = os.path.splitext(script) if script_ext != '.py': log.debug("Not removing extension from {script} " "since it's not '.py'".format(script=script)) else: log.debug("Copying {orig} -> {dest}".format( orig=script, dest=script_copy)) self.copy_file(script, script_copy) self.scripts.append(script_copy) # distutils is compatible with 2.1 so we cannot use super() to # call it. _build_scripts.run(self) self.outfiles = self.scripts self.scripts = saved_scripts def get_outputs(self): """Get installed files""" return self.outfiles COMMANDS['cmdclass'].update({ 'install': install, }) if os.name != "nt": COMMANDS['cmdclass'].update({ 'build_scripts': build_scripts, 'install_man': install_man, }) ARGS.update(META_INFO) ARGS.update(INSTALL) ARGS.update(COMMANDS) setup(**ARGS) mysql-utilities-1.3.5/PKG-INFO0000644001577100000120000000200612210052300015220 0ustar pb2userwheelMetadata-Version: 1.1 Name: mysql-utilities Version: 1.3.5 Summary: MySQL Utilities 1.3.5 (part of MySQL Workbench Distribution 5.2.47) Home-page: http://dev.mysql.com Author: Oracle Author-email: UNKNOWN License: GNU GPLv2 (with FOSS License Exception) Description: UNKNOWN Keywords: mysql db Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Environment :: Console Classifier: Environment :: Win32 (MS Windows) Classifier: License :: OSI Approved :: GNU General Public License (GPL) Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators Classifier: Intended Audience :: Database Administrators Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: OS Independent Classifier: Operating System :: POSIX Classifier: Topic :: Utilities Requires: distutils Requires: sphinx (>=1.0) Requires: jinja2 (>=2.1) Provides: mysql.utilities mysql-utilities-1.3.5/docs/0000755001577100000120000000000012210052300015055 5ustar pb2userwheelmysql-utilities-1.3.5/docs/man/0000755001577100000120000000000012210052300015630 5ustar pb2userwheelmysql-utilities-1.3.5/docs/man/mysqldbcopy.10000644001577100000120000004274012210044426020301 0ustar pb2userwheel'\" t .\" Title: \fBmysqldbcopy\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 08/30/2013 .\" Manual: MySQL Utilities .\" Source: MySQL 1.3.4 .\" Language: English .\" .TH "\FBMYSQLDBCOPY\FR" "1" "08/30/2013" "MySQL 1\&.3\&.4" "MySQL Utilities" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .\" mysqldbcopy .\" utilities: mysqldbcopy .\" scripts .SH "NAME" mysqldbcopy \- Copy Database Objects Between Servers .SH "SYNOPSIS" .HP \w'\fBmysqldbcopy\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fI:new_db_name\fR\fR\fB]\fR\ 'u \fBmysqldbcopy [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fI:new_db_name\fR\fR\fB]\fR .SH "DESCRIPTION" .PP This utility copies a database on a source server to a database on a destination server\&. If the source and destination servers are different, the database names can be the same or different\&. If the source and destination servers are the same, the database names must be different\&. .PP The utility accepts one or more database pairs on the command line\&. To name a database pair, use \fIdb_name\fR:\fInew_db_name\fR syntax to specify the source and destination names explicitly\&. If the source and destination database names are the same, \fIdb_name\fR can be used as shorthand for \fIdb_name\fR:\fIdb_name\fR\&. .PP By default, the operation copies all objects (tables, views, triggers, events, procedures, functions, and database\-level grants) and data to the destination server\&. There are options to turn off copying any or all of the objects as well as not copying the data\&. .PP To exclude specific objects by name, use the \fB\-\-exclude\fR option with a name in \fIdb\fR\&.*obj* format, or you can supply a search pattern\&. For example, \fB\-\-exclude=db1\&.trig1\fR excludes the single trigger and \fB\-\-exclude=trig_\fR excludes all objects from all databases having a name that begins with trig and has a following character\&. .PP By default, the utility creates each table on the destination server using the same storage engine as the original table\&. To override this and specify the storage engine to use for all tables created on the destination server, use the \fB\-\-new\-storage\-engine\fR option\&. If the destination server supports the new engine, all tables use that engine\&. .PP To specify the storage engine to use for tables for which the destination server does not support the original storage engine on the source server, use the \fB\-\-default\-storage\-engine\fR option\&. .PP The \fB\-\-new\-storage\-engine\fR option takes precedence over \fB\-\-default\-storage\-engine\fR if both are given\&. .PP If the \fB\-\-new\-storage\-engine\fR or \fB\-\-default\-storage\-engine\fR option is given and the destination server does not support the specified storage engine, a warning is issued and the server\*(Aqs default storage engine setting is used instead\&. .PP By default, the operation uses a consistent snapshot to read the source databases\&. To change the locking mode, use the \fB\-\-locking\fR option with a locking type value\&. Use a value of \fBno\-locks\fR to turn off locking altogether or \fBlock\-all\fR to use only table locks\&. The default value is \fBsnapshot\fR\&. Additionally, the utility uses WRITE locks to lock the destination tables during the copy\&. .PP You can include replication statements for copying data among a master and slave or between slaves\&. The \fB\-\-rpl\fR option permits you to select from the following replication statements to include in the export\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBmaster\fR .sp Include the \fBCHANGE MASTER\fR statement to start a new slave with the current server acting as the master\&. This executes the appropriate STOP and START slave statements\&. The \fBSTOP SLAVE\fR statement is executed at the start of the copy and the \fBCHANGE MASTER\fR followed by the \fBSTART SLAVE\fR statements are executed after the copy\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBslave\fR .sp Include the \fBCHANGE MASTER\fR statement to start a new slave using the current server\*(Aqs master information\&. This executes the appropriate STOP and START slave statements\&. The STOP SLAVE statement is executed at the start of the copy and the \fBCHANGE MASTER\fR followed by the \fBSTART SLAVE\fR statements follow the copy\&. .RE .PP To include the replication user in the \fBCHANGE MASTER\fR statement, use the \fB\-\-rpl\-user\fR option to specify the user and password\&. If this option is omitted, the utility attempts to identify the replication user\&. In the event that there are multiple candidates or the user requires a password, the utility aborts with an error\&. .PP If you attempt to copy databases on a server with GTIDs enabled (GTID_MODE = ON), a warning will be generated if the copy does not include all databases\&. This is because the GTID statements generated include the GTIDs for all databases and not only those databases in the export\&. .PP The utility will also generate a warning if you copy databases on a GTID enabled server but use the \fB\-\-skip\-gtid \fR option\&. .PP To make the most use of GTIDs, you should copy all of the databases on the server with the \fB\-\-all\fR option\&. OPTIONS .PP \fBmysqldbcopy\fR accepts the following command\-line options: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-help .sp Display a help message and exit\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-default\-storage\-engine= .sp The engine to use for tables if the destination server does not support the original storage engine on the source server\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-destination= .sp Connection information for the destination server in the format: <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] or <\fIlogin\-path\fR>[:<\fIport\fR>][:<\fIsocket\fR>] (where is optional and either or must be provided)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-exclude=, \-x .sp Exclude one or more objects from the operation using either a specific name such as db1\&.t1 or a search pattern\&. Use this option multiple times to specify multiple exclusions\&. By default, patterns use \fBLIKE\fR matching\&. With the \fB\-\-regexp\fR option, patterns use \fBREGEXP\fR matching\&. .sp This option does not apply to grants\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-force .sp Drop each database to be copied if exists before copying anything into it\&. Without this option, an error occurs if you attempt to copy objects into an existing database\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-locking= .sp Choose the lock type for the operation\&. Permitted lock values are \fBno\-locks\fR (do not use any table locks), \fBlock\-all\fR (use table locks but no transaction and no consistent read), and \fBsnapshot\fR (consistent read using a single transaction)\&. The default is \fBsnapshot\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-new\-storage\-engine= .sp The engine to use for all tables created on the destination server\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-quiet, \-q .sp Turn off all messages for quiet execution\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-regexp, \-\-basic\-regexp, \-G .sp Perform pattern matches using the \fBREGEXP\fR operator\&. The default is to use \fBLIKE\fR for matching\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-rpl=, \-\-replication= .sp Include replication information\&. Permitted values are \fBmaster\fR (include the \fBCHANGE MASTER\fR statement using the source server as the master), \fBslave\fR (include the \fBCHANGE MASTER\fR statement using the destination server\*(Aqs master information), and \fBboth\fR (include the \fBmaster\fR and \fBslave\fR options where applicable)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-rpl\-user= .sp The user and password for the replication user requirement in the form: <\fIuser\fR>[:<\fIpassword\fR>] or <\fIlogin\-path\fR>\&. E\&.g\&. rpl:passwd Default = None\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} l \-\-skip\-gtid .sp Skip creation and execution of GTID statements during the copy operation\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-all .sp Copy all of the databases on the server\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-skip= .sp Specify objects to skip in the operation as a comma\-separated list (no spaces)\&. Permitted values are \fBCREATE_DB\fR, \fBDATA\fR, \fBEVENTS\fR, \fBFUNCTIONS\fR, \fBGRANTS\fR, \fBPROCEDURES\fR, \fBTABLES\fR, \fBTRIGGERS\fR, and \fBVIEWS\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-source= .sp Connection information for the destination server in the format: <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] or <\fIlogin\-path\fR>[::<\fIport\fR>][::<\fIsocket\fR>] (where is optional and either or must be provided)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-threads .sp Use multiple threads for cross\-server copy\&. The default is 1\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-verbose, \-v .sp Specify how much information to display\&. Use this option multiple times to increase the amount of information\&. For example, \fB\-v\fR = verbose, \fB\-vv\fR = more verbose, \fB\-vvv\fR = debug\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-version .sp Display version information and exit\&. .RE NOTES .PP You must provide connection parameters (user, host, password, and so forth) for an account that has the appropriate privileges to access all objects in the operation\&. .PP To copy all objects from a source, the user must have these privileges: \fBSELECT\fR and \fBSHOW VIEW\fR for the database, and \fBSELECT\fR for the mysql database\&. .PP To copy all objects to a destination, the user must have these privileges: \fBCREATE\fR for the database, \fBSUPER\fR (when binary logging is enabled) for procedures and functions, and \fBGRANT OPTION\fR to copy grants\&. .PP Actual privileges required may differ from installation to installation depending on the security privileges present and whether the database contains certain objects such as views or events and whether binary logging is enabled\&. .PP The \fB\-\-new\-storage\-engine\fR and \fB\-\-default\-storage\-engine\fR options apply to all destination tables in the operation\&. .PP Some option combinations may result in errors during the operation\&. For example, eliminating tables but not views may result in an error a the view is copied\&. .PP The \fB\-\-rpl\fR option is not valid for copying databases on the same server\&. An error will be generated\&. .PP When copying data and including the GTID commands, you may encounter an error similar to "GTID_PURGED can only be set when GTID_EXECUTED is empty"\&. This occurs because the destination server is not in a clean replication state\&. To aleviate this problem, you can issue a "RESET MASTER" command on the destination prior to executing the copy\&. .PP Cloning databases that contain foreign key constraints does not change the constraint in the cloned table\&. For example, if table db1\&.t1 has a foreign key constraint on table db1\&.t2, when db1 is cloned to db2, table db2\&.t1 will have a foreign key constraint on db1\&.t2\&. .PP The path to the MySQL client tools should be included in the PATH environment variable in order to use the authentication mechanism with login\-paths\&. This will allow the utility to use the my_print_defaults tools which is required to read the login\-path values from the login configuration file (\&.mylogin\&.cnf)\&. .PP If any database identifier specified as an argument contains special characters or is a reserved word, then it must be appropriately quoted with backticks (\fB`\fR)\&. In turn, names quoted with backticks must also be quoted with single or double quotes depending on the operating system, i\&.e\&. (\fB"\fR) in Windows or (\fB\*(Aq\fR) in non\-Windows systems, in order for the utilities to read backtick quoted identifiers as a single argument\&. For example, to copy a database with the name \fBweird`db\&.name\fR with \fBother:weird`db\&.name\fR, the database pair must be specified using the following syntax (in non\-Windows): \fB\*(Aq`weird``db\&.name`:`other:weird``db\&.name`\*(Aq\fR\&. EXAMPLES .PP The following example demonstrates how to use the utility to copy a database named util_test to a new database named util_test_copy on the same server: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbcopy \e \-\-source=root:pass@localhost:3310:/test123/mysql\&.sock \e \-\-destination=root:pass@localhost:3310:/test123/mysql\&.sock \e util_test:util_test_copy # Source on localhost: \&.\&.\&. connected\&. # Destination on localhost: \&.\&.\&. connected\&. # Copying database util_test renamed as util_test_copy # Copying TABLE util_test\&.t1 # Copying table data\&. # Copying TABLE util_test\&.t2 # Copying table data\&. # Copying TABLE util_test\&.t3 # Copying table data\&. # Copying TABLE util_test\&.t4 # Copying table data\&. # Copying VIEW util_test\&.v1 # Copying TRIGGER util_test\&.trg # Copying PROCEDURE util_test\&.p1 # Copying FUNCTION util_test\&.f1 # Copying EVENT util_test\&.e1 # Copying GRANTS from util_test #\&.\&.\&.done\&. .fi .if n \{\ .RE .\} .PP If the database to be copied does not contain only InnoDB tables and you want to ensure data integrity of the copied data by locking the tables during the read step, add a \fB\-\-locking=lock\-all\fR option to the command: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbcopy \e \-\-source=root:pass@localhost:3310:/test123/mysql\&.sock \e \-\-destination=root:pass@localhost:3310:/test123/mysql\&.sock \e util_test:util_test_copy \-\-locking=lock\-all # Source on localhost: \&.\&.\&. connected\&. # Destination on localhost: \&.\&.\&. connected\&. # Copying database util_test renamed as util_test_copy # Copying TABLE util_test\&.t1 # Copying table data\&. # Copying TABLE util_test\&.t2 # Copying table data\&. # Copying TABLE util_test\&.t3 # Copying table data\&. # Copying TABLE util_test\&.t4 # Copying table data\&. # Copying VIEW util_test\&.v1 # Copying TRIGGER util_test\&.trg # Copying PROCEDURE util_test\&.p1 # Copying FUNCTION util_test\&.f1 # Copying EVENT util_test\&.e1 # Copying GRANTS from util_test #\&.\&.\&.done\&. .fi .if n \{\ .RE .\} .PP To copy one or more databases from a master to a slave, you can use the following command to copy the databases\&. Use the master as the source and the slave as the destination: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbcopy \-\-source=root@localhost:3310 \e \-\-destination=root@localhost:3311 test123 \-\-rpl=master \e \-\-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\&. .fi .if n \{\ .RE .\} .PP To copy a database from one slave to another attached to the same master, you can use the following command using the slave with the database to be copied as the source and the slave where the database needs to copied to as the destination: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbcopy \-\-source=root@localhost:3311 \e \-\-destination=root@localhost:3312 test123 \-\-rpl=slave \e \-\-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\*(Aqs master # Starting slave #\&.\&.\&.done\&. .fi .if n \{\ .RE .\} .SH "COPYRIGHT" .br .SH "SEE ALSO" For more information, please refer to the MySQL Utilities section of the MySQL Workbench Reference Manual, which is available online at http://dev.mysql.com/doc/workbench/en/. .SH AUTHOR Oracle Corporation (http://dev.mysql.com/). mysql-utilities-1.3.5/docs/man/mysqldbexport.10000644001577100000120000005756612210044426020664 0ustar pb2userwheel'\" t .\" Title: \fBmysqldbexport\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 08/30/2013 .\" Manual: MySQL Utilities .\" Source: MySQL 1.3.4 .\" Language: English .\" .TH "\FBMYSQLDBEXPORT\FR" "1" "08/30/2013" "MySQL 1\&.3\&.4" "MySQL Utilities" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .\" mysqldbexport .\" utilities: mysqldbexport .\" scripts .SH "NAME" mysqldbexport \- Export Object Definitions or Data from a Database .SH "SYNOPSIS" .HP \w'\fBmysqldbexport\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\fB\ \&.\&.\&.\fR\ 'u \fBmysqldbexport [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR .SH "DESCRIPTION" .PP This utility exports metadata (object definitions) or data or both from one or more databases\&. By default, the export includes only definitions\&. .PP \fBmysqldbexport\fR differs from \fBmysqldump\fR in that it can produce output in a variety of formats to make your data extraction/transport much easier\&. It permits you to export your data in the format most suitable to an external tool, another MySQL server, or other use without the need to reformat the data\&. .PP To exclude specific objects by name, use the \fB\-\-exclude\fR option with a name in \fIdb\fR\&.*obj* format, or you can supply a search pattern\&. For example, \fB\-\-exclude=db1\&.trig1\fR excludes the single trigger and \fB\-\-exclude=trig_\fR excludes all objects from all databases having a name that begins with trig and has a following character\&. .PP To skip objects by type, use the \fB\-\-skip\fR option with a list of the objects to skip\&. This enables you to extract a particular set of objects, say, for exporting only events (by excluding all other types)\&. Similarly, to skip creation of \fBUPDATE\fR statements for BLOB data, specify the \fB\-\-skip\-blobs\fR option\&. .PP To specify how to display output, use one of the following values with the \fB\-\-format\fR option: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBsql\fR (default) .sp Display output using SQL statements\&. For definitions, this consists of the appropriate \fBCREATE\fR and \fBGRANT\fR statements\&. For data, this is an \fBINSERT\fR statement (or bulk insert if the \fB\-\-bulk\-insert\fR option is specified)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBgrid\fR .sp Display output in grid or table format like that of the \fBmysql\fR monitor\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBcsv\fR .sp Display output in comma\-separated values format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBtab\fR .sp Display output in tab\-separated format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBvertical\fR .sp Display output in single\-column format like that of the \eG command for the \fBmysql\fR monitor\&. .RE .PP To specify how much data to display, use one of the following values with the \fB\-\-display\fR option: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBbrief\fR .sp Display only the minimal columns for recreating the objects\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBfull\fR .sp Display the complete column list for recreating the objects\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBnames\fR .sp Display only the object names\&. .RE .PP Note: For SQL\-format output, the \fB\-\-display\fR option is ignored\&. .PP To turn off the headers for \fBcsv\fR or \fBtab\fR display format, specify the \fB\-\-no\-headers\fR option\&. .PP To turn off all feedback information, specify the \fB\-\-quiet\fR option\&. .PP To write the data for individual tables to separate files, use the \fB\-\-file\-per\-table\fR option\&. The name of each file is composed of the database and table names followed by the file format\&. For example, the following command produces files named db1\&.*table_name*\&.csv: .sp .if n \{\ .RS 4 .\} .nf mysqldbexport \-\-server=root@server1:3306 \-\-format=csv db1 \-\-export=data .fi .if n \{\ .RE .\} .PP By default, the operation uses a consistent snapshot to read the source databases\&. To change the locking mode, use the \fB\-\-locking\fR option with a locking type value\&. Use a value of \fBno\-locks\fR to turn off locking altogether or \fBlock\-all\fR to use only table locks\&. The default value is \fBsnapshot\fR\&. Additionally, the utility uses WRITE locks to lock the destination tables during the copy\&. .PP You can include replication statements for exporting data among a master and slave or between slaves\&. The \fB\-\-rpl\fR option permits you to select from the following replication statements to include in the export\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBmaster\fR .sp Include the \fBCHANGE MASTER\fR statement to start a new slave with the current server acting as the master\&. This places the appropriate STOP and START slave statements in the export whereby the \fBSTOP SLAVE\fR statement is placed at the start of the export and the \fBCHANGE MASTER\fR followed by the \fBSTART SLAVE\fR statements are placed after the export stream\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBslave\fR .sp Include the \fBCHANGE MASTER\fR statement to start a new slave using the current server\*(Aqs master information\&. This places the appropriate STOP and START slave statements in the export whereby the \fBSTOP SLAVE\fR statement is placed at the start of the export and the \fBCHANGE MASTER\fR followed by the \fBSTART SLAVE\fR statements are placed after the export stream\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBboth\fR .sp Include both the \*(Aqmaster\*(Aq and \*(Aqslave\*(Aq information for \fBCHANGE MASTER\fR statements for either spawning a new slave with the current server\*(Aqs master or using the current server as the master\&. All statements generated are labeled and commented to enable the user to choose which to include when imported\&. .RE .PP To include the replication user in the \fBCHANGE MASTER\fR statement, use the \fB\-\-rpl\-user\fR option to specify the user and password\&. If this option is omitted, the utility attempts to identify the replication user\&. In the event that there are multiple candidates or the user requires a password, these statements are placed inside comments for the \fBCHANGE MASTER\fR statement\&. .PP You can also use the \fB\-\-comment\-rpl\fR option to place the replication statements inside comments for later examination\&. .PP If you specify the \fB\-\-rpl\-file\fR option, the utility writes the replication statements to the file specified instead of including them in the export stream\&. .PP If you attempt to export databases on a server with GTIDs enabled (GTID_MODE = ON), a warning will be generated if the export does not include all databases\&. This is because the GTID statements generated include the GTIDs for all databases and not only those databases in the export\&. .PP The utility will also generate a warning if you export databases on a GTID enabled server but use the \fB\-\-skip\-gtid \fR option\&. .PP To make the most use of GTIDs and export/import, you should export all of the databases on the server with the \fB\-\-all\fR option\&. This will generate an export file with all of the databases and the GTIDs executed to that point\&. .PP Importing this file on another server will ensure that server has all of the data as well as all of the GTIDs recorded correctly in its logs\&. OPTIONS .PP \fBmysqldbexport\fR accepts the following command\-line options: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-help .sp Display a help message and exit\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-bulk\-insert, \-b .sp Use bulk insert statements for data\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-comment\-rpl .sp Place the replication statements in comment statements\&. Valid only with the \fB\-\-rpl\fR option\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-display=, \-d .sp Control the number of columns shown\&. Permitted display values are \fBbrief\fR (minimal columns for object creation), \fBfull* (all columns), and **names\fR (only object names; not valid for \fB\-\-format=sql\fR)\&. The default is \fBbrief\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-exclude=, \-x .sp Exclude one or more objects from the operation using either a specific name such as db1\&.t1 or a search pattern\&. Use this option multiple times to specify multiple exclusions\&. By default, patterns use \fBLIKE\fR matching\&. With the \fB\-\-regexp\fR option, patterns use \fBREGEXP\fR matching\&. .sp This option does not apply to grants\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-export=, \-e .sp Specify the export format\&. Permitted format values are \fBdefinitions\fR = export only the definitions (metadata) for the objects in the database list, \fBdata\fR = export only the table data for the tables in the database list, and \fBboth\fR = export the definitions and the data\&. The default is \fBdefinitions\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-file\-per\-table .sp Write table data to separate files\&. This is Valid only if the export output includes data (that is, if \fB\-\-export=data\fR or \fB\-\-export=both\fR are given)\&. This option produces files named \fIdb_name\fR\&.*tbl_name*\&.*format*\&. For example, a \fBcsv\fR export of two tables named t1 and t2 in database d1, results in files named db1\&.t1\&.csv and db1\&.t2\&.csv\&. If table definitions are included in the export, they are written to stdout as usual\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-format=, \-f .sp Specify the output display format\&. Permitted format values are \fBsql\fR, \fBgrid\fR, \fBtab\fR, \fBcsv\fR, and \fBvertical\fR\&. The default is \fBsql\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-locking= .sp Choose the lock type for the operation\&. Permitted lock values are \fBno\-locks\fR (do not use any table locks), \fBlock\-all\fR (use table locks but no transaction and no consistent read), and \fBsnapshot\fR (consistent read using a single transaction)\&. The default is \fBsnapshot\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-no\-headers, \-h .sp Do not display column headers\&. This option applies only for \fBcsv\fR and \fBtab\fR output\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-quiet, \-q .sp Turn off all messages for quiet execution\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-regexp, \-\-basic\-regexp, \-G .sp Perform pattern matches using the \fBREGEXP\fR operator\&. The default is to use \fBLIKE\fR for matching\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-rpl=, \-\-replication= .sp Include replication information\&. Permitted values are \fBmaster\fR (include the \fBCHANGE MASTER\fR statement using the source server as the master), \fBslave\fR (include the \fBCHANGE MASTER\fR statement using the destination server\*(Aqs master information), and \fBboth\fR (include the \fBmaster\fR and \fBslave\fR options where applicable)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-rpl\-file=RPL_FILE, \-\-replication\-file=RPL_FILE .sp The path and file name where the generated replication information should be written\&. Valid only with the \fB\-\-rpl\fR option\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-rpl\-user= .sp The user and password for the replication user requirement, in the format: <\fIuser\fR>[:<\fIpassword\fR>] or <\fIlogin\-path\fR>\&. For example, rpl:passwd\&. The default is None\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-server= .sp Connection information for the server in <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] or <\fIlogin\-path\fR>[::<\fIport\fR>][::<\fIsocket\fR>]\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-skip= .sp Specify objects to skip in the operation as a comma\-separated list (no spaces)\&. Permitted values are \fBCREATE_DB\fR, \fBDATA\fR, \fBEVENTS\fR, \fBFUNCTIONS\fR, \fBGRANTS\fR, \fBPROCEDURES\fR, \fBTABLES\fR, \fBTRIGGERS\fR, and \fBVIEWS\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-skip\-blobs .sp Do not export BLOB data\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-skip\-gtid .sp Skip creation of GTID_PURGED statements\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-all .sp Generate an export file with all of the databases and the GTIDs executed to that point\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-verbose, \-v .sp Specify how much information to display\&. Use this option multiple times to increase the amount of information\&. For example, \fB\-v\fR = verbose, \fB\-vv\fR = more verbose, \fB\-vvv\fR = debug\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-version .sp Display version information and exit\&. .RE NOTES .PP You must provide connection parameters (user, host, password, and so forth) for an account that has the appropriate privileges to access all objects in the operation\&. .PP To export all objects from a source database, the user must have these privileges: \fBSELECT\fR and \fBSHOW VIEW\fR on the database as well as \fBSELECT\fR on the mysql database\&. .PP Actual privileges needed may differ from installation to installation depending on the security privileges present and whether the database contains certain objects such as views or events\&. .PP Some combinations of the options may result in errors when the export is imported later\&. For example, eliminating tables but not views may result in an error when a view is imported on another server\&. .PP For the \fB\-\-format\fR, \fB\-\-export\fR, and \fB\-\-display\fR options, the permitted values are not case sensitive\&. In addition, values may be specified as any unambiguous prefix of a valid value\&. For example, \fB\-\-format=g\fR specifies the grid format\&. An error occurs if a prefix matches more than one valid value\&. .PP The path to the MySQL client tools should be included in the PATH environment variable in order to use the authentication mechanism with login\-paths\&. This will allow the utility to use the my_print_defaults tools which is required to read the login\-path values from the login configuration file (\&.mylogin\&.cnf)\&. .PP If any database identifier specified as an argument contains special characters or is a reserved word, then it must be appropriately quoted with backticks (\fB`\fR)\&. In turn, names quoted with backticks must also be quoted with single or double quotes depending on the operating system, i\&.e\&. (\fB"\fR) in Windows or (\fB\*(Aq\fR) in non\-Windows systems, in order for the utilities to read backtick quoted identifiers as a single argument\&. For example, to export a database with the name \fBweird`db\&.name\fR, it must be specified as argument using the following syntax (in non\-Windows): \fB\*(Aq`weird``db\&.name`\*(Aq\fR\&. EXAMPLES .PP To export the definitions of the database dev from a MySQL server on the local host via port 3306, producing output consisting of \fBCREATE\fR statements, use this command: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbexport \-\-server=root:pass@localhost \e \-\-skip=GRANTS \-\-export=DEFINITIONS util_test # Source on localhost: \&.\&.\&. connected\&. # Exporting metadata from util_test DROP DATABASE IF EXISTS util_test; CREATE DATABASE util_test; USE util_test; # TABLE: util_test\&.t1 CREATE TABLE `t1` ( `a` char(30) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1; # TABLE: util_test\&.t2 CREATE TABLE `t2` ( `a` char(30) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; # TABLE: util_test\&.t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL AUTO_INCREMENT, `b` char(30) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; # TABLE: util_test\&.t4 CREATE TABLE `t4` ( `c` int(11) NOT NULL, `d` int(11) NOT NULL, KEY `ref_t3` (`c`), CONSTRAINT `ref_t3` FOREIGN KEY (`c`) REFERENCES `t3` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; # VIEW: util_test\&.v1 [\&.\&.\&.] #\&.\&.\&.done\&. .fi .if n \{\ .RE .\} .PP Similarly, to export the data of the database util_test, producing bulk insert statements, use this command: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbexport \-\-server=root:pass@localhost \e \-\-export=DATA \-\-bulk\-insert util_test # Source on localhost: \&.\&.\&. connected\&. USE util_test; # Exporting data from util_test # Data for table util_test\&.t1: INSERT INTO util_test\&.t1 VALUES (\*(Aq01 Test Basic database example\*(Aq), (\*(Aq02 Test Basic database example\*(Aq), (\*(Aq03 Test Basic database example\*(Aq), (\*(Aq04 Test Basic database example\*(Aq), (\*(Aq05 Test Basic database example\*(Aq), (\*(Aq06 Test Basic database example\*(Aq), (\*(Aq07 Test Basic database example\*(Aq); # Data for table util_test\&.t2: INSERT INTO util_test\&.t2 VALUES (\*(Aq11 Test Basic database example\*(Aq), (\*(Aq12 Test Basic database example\*(Aq), (\*(Aq13 Test Basic database example\*(Aq); # Data for table util_test\&.t3: INSERT INTO util_test\&.t3 VALUES (1, \*(Aq14 test fkeys\*(Aq), (2, \*(Aq15 test fkeys\*(Aq), (3, \*(Aq16 test fkeys\*(Aq); # Data for table util_test\&.t4: INSERT INTO util_test\&.t4 VALUES (3, 2); #\&.\&.\&.done\&. .fi .if n \{\ .RE .\} .PP If the database to be exported does not contain only InnoDB tables and you want to ensure data integrity of the exported data by locking the tables during the read step, add a \fB\-\-locking=lock\-all\fR option to the command: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbexport \-\-server=root:pass@localhost \e \-\-export=DATA \-\-bulk\-insert util_test \-\-locking=lock\-all # Source on localhost: \&.\&.\&. connected\&. USE util_test; # Exporting data from util_test # Data for table util_test\&.t1: INSERT INTO util_test\&.t1 VALUES (\*(Aq01 Test Basic database example\*(Aq), (\*(Aq02 Test Basic database example\*(Aq), (\*(Aq03 Test Basic database example\*(Aq), (\*(Aq04 Test Basic database example\*(Aq), (\*(Aq05 Test Basic database example\*(Aq), (\*(Aq06 Test Basic database example\*(Aq), (\*(Aq07 Test Basic database example\*(Aq); # Data for table util_test\&.t2: INSERT INTO util_test\&.t2 VALUES (\*(Aq11 Test Basic database example\*(Aq), (\*(Aq12 Test Basic database example\*(Aq), (\*(Aq13 Test Basic database example\*(Aq); # Data for table util_test\&.t3: INSERT INTO util_test\&.t3 VALUES (1, \*(Aq14 test fkeys\*(Aq), (2, \*(Aq15 test fkeys\*(Aq), (3, \*(Aq16 test fkeys\*(Aq); # Data for table util_test\&.t4: INSERT INTO util_test\&.t4 VALUES (3, 2); #\&.\&.\&.done\&. .fi .if n \{\ .RE .\} .PP To export a database and include the replication commands to use the current server as the master (for example, to start a new slave using the current server as the master), use the following command: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbexport \-\-server=root@localhost:3311 util_test \e \-\-export=both \-\-rpl\-user=rpl:rpl \-\-rpl=master \-v # Source on localhost: \&.\&.\&. connected\&. # # Stopping slave STOP SLAVE; # # Source on localhost: \&.\&.\&. connected\&. # Exporting metadata from util_test DROP DATABASE IF EXISTS util_test; CREATE DATABASE util_test; USE util_test; # TABLE: util_test\&.t1 CREATE TABLE `t1` ( `a` char(30) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1; #\&.\&.\&.done\&. # Source on localhost: \&.\&.\&. connected\&. USE util_test; # Exporting data from util_test # Data for table util_test\&.t1: INSERT INTO util_test\&.t1 VALUES (\*(Aq01 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq02 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq03 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq04 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq05 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq06 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq07 Test Basic database example\*(Aq); #\&.\&.\&.done\&. # # Connecting to the current server as master CHANGE MASTER TO MASTER_HOST = \*(Aqlocalhost\*(Aq, MASTER_USER = \*(Aqrpl\*(Aq, MASTER_PASSWORD = \*(Aqrpl\*(Aq, MASTER_PORT = 3311, MASTER_LOG_FILE = \*(Aqclone\-bin\&.000001\*(Aq , MASTER_LOG_POS = 106; # # Starting slave START SLAVE; # .fi .if n \{\ .RE .\} .PP Similarly, to export a database and include the replication commands to use the current server\*(Aqs master (for example, to start a new slave using the same the master), use the following command: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbexport \-\-server=root@localhost:3311 util_test \e \-\-export=both \-\-rpl\-user=rpl:rpl \-\-rpl=slave \-v # Source on localhost: \&.\&.\&. connected\&. # # Stopping slave STOP SLAVE; # # Source on localhost: \&.\&.\&. connected\&. # Exporting metadata from util_test DROP DATABASE IF EXISTS util_test; CREATE DATABASE util_test; USE util_test; # TABLE: util_test\&.t1 CREATE TABLE `t1` ( `a` char(30) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1; #\&.\&.\&.done\&. # Source on localhost: \&.\&.\&. connected\&. USE util_test; # Exporting data from util_test # Data for table util_test\&.t1: INSERT INTO util_test\&.t1 VALUES (\*(Aq01 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq02 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq03 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq04 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq05 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq06 Test Basic database example\*(Aq); INSERT INTO util_test\&.t1 VALUES (\*(Aq07 Test Basic database example\*(Aq); #\&.\&.\&.done\&. # # Connecting to the current server\*(Aqs master CHANGE MASTER TO MASTER_HOST = \*(Aqlocalhost\*(Aq, MASTER_USER = \*(Aqrpl\*(Aq, MASTER_PASSWORD = \*(Aqrpl\*(Aq, MASTER_PORT = 3310, MASTER_LOG_FILE = \*(Aqclone\-bin\&.000001\*(Aq , MASTER_LOG_POS = 1739; # # Starting slave START SLAVE; # .fi .if n \{\ .RE .\} .SH "COPYRIGHT" .br .SH "SEE ALSO" For more information, please refer to the MySQL Utilities section of the MySQL Workbench Reference Manual, which is available online at http://dev.mysql.com/doc/workbench/en/. .SH AUTHOR Oracle Corporation (http://dev.mysql.com/). mysql-utilities-1.3.5/docs/man/mysqldbimport.10000644001577100000120000003244012210044426020635 0ustar pb2userwheel'\" t .\" Title: \fBmysqldbimport\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 08/30/2013 .\" Manual: MySQL Utilities .\" Source: MySQL 1.3.4 .\" Language: English .\" .TH "\FBMYSQLDBIMPORT\FR" "1" "08/30/2013" "MySQL 1\&.3\&.4" "MySQL Utilities" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .\" mysqldbimport .\" utilities: mysqldbimport .\" scripts .SH "NAME" mysqldbimport \- Import Object Definitions or Data into a Databases .SH "SYNOPSIS" .HP \w'\fBmysqldbimport\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIimport_file\fR\fR\fB\ \&.\&.\&.\fR\ 'u \fBmysqldbimport [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIimport_file\fR\fR\fB \&.\&.\&.\fR .SH "DESCRIPTION" .PP This utility imports metadata (object definitions) or data or both for one or more databases from one or more files\&. .PP If an object exists on the destination server with the same name as an imported object, it is dropped first before importing the new object\&. .PP To skip objects by type, use the \fB\-\-skip\fR option with a list of the objects to skip\&. This enables you to extract a particular set of objects, say, for importing only events (by excluding all other types)\&. Similarly, to skip creation of \fBUPDATE\fR statements for BLOB data, specify the \fB\-\-skip\-blobs\fR option\&. .PP To specify the input format, use one of the following values with the \fB\-\-format\fR option\&. These correspond to the output formats of the \fBmysqldbexport\fR utility: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBsql\fR (default) .sp Input consists of SQL statements\&. For definitions, this consists of the appropriate \fBCREATE\fR and \fBGRANT\fR statements\&. For data, this is an \fBINSERT\fR statement (or bulk insert if the \fB\-\-bulk\-insert\fR option is specified)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBgrid\fR .sp Display output in grid or table format like that of the \fBmysql\fR monitor\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBcsv\fR .sp Input is formatted in comma\-separated values format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBraw_csv\fR .sp Input is a simple CSV file containing uniform rows with values separated with commas\&. The file can contain a header (the first row) that lists the table columns\&. The option \fB\-\-table\fR is required to use this format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBtab\fR .sp Input is formatted in tab\-separated format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBvertical\fR .sp Display output in single\-column format like that of the \eG command for the \fBmysql\fR monitor\&. .RE .PP To indicate that input in \fBcsv\fR or \fBtab\fR format does not contain column headers, specify the \fB\-\-no\-headers\fR option\&. .PP To turn off all feedback information, specify the \fB\-\-quiet\fR option\&. .PP By default, the utility creates each table on the destination server using the same storage engine as the original table\&. To override this and specify the storage engine to use for all tables created on the destination server, use the \fB\-\-new\-storage\-engine\fR option\&. If the destination server supports the new engine, all tables use that engine\&. .PP To specify the storage engine to use for tables for which the destination server does not support the original storage engine on the source server, use the \fB\-\-default\-storage\-engine\fR option\&. .PP The \fB\-\-new\-storage\-engine\fR option takes precedence over \fB\-\-default\-storage\-engine\fR if both are given\&. .PP If the \fB\-\-new\-storage\-engine\fR or \fB\-\-default\-storage\-engine\fR option is given and the destination server does not support the specified storage engine, a warning is issued and the server\*(Aqs default storage engine setting is used instead\&. .PP You must provide connection parameters (user, host, password, and so forth) for an account that has the appropriate privileges to access all objects in the operation\&. For details, see NOTES\&. .PP If you attempt to import databases on a server with GTIDs enabled (GTID_MODE = ON), a warning will be generated if the import file did not include the GTID statements generated by mysqldbexport\&. .PP The utility will also generate a warning if you import databases on a server without GTIDs enabled and there are GTID statements present in the file\&. Use the \fB\-\-skip\-gtid\fR option to ignore the GTID statements\&. .PP To make the most use of GTIDs and export/import, you should export all of the databases on the server with the \fB \-\-all\fR option\&. This will generate an export file with all of the databases and the GTIDs executed to that point\&. Importing this file on another server will ensure that server has all of the data as well as all of the GTIDs recorded correctly in its logs\&. OPTIONS .PP \fBmysqldbimport\fR accepts the following command\-line options: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-help .sp Display a help message and exit\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-bulk\-insert, \-b .sp Use bulk insert statements for data\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-default\-storage\-engine= .sp The engine to use for tables if the destination server does not support the original storage engine on the source server\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-drop\-first, \-d .sp Drop each database to be imported if exists before importing anything into it\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-dryrun .sp Import the files and generate the statements but do not execute them\&. This is useful for testing input file validity\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-format=, \-f .sp Specify the input format\&. Permitted format values are \fBsql\fR, \fBgrid\fR, \fBtab\fR, \fBcsv\fR, \fBraw_csv\fR, and \fBvertical\fR\&. The default is \fBsql\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-import=, \-i .sp Specify the import format\&. Permitted format values are \fBdefinitions\fR = import only the definitions (metadata) for the objects in the database list, \fBdata\fR = import only the table data for the tables in the database list, and \fBboth\fR = import the definitions and the data\&. The default is \fBdefinitions\fR\&. .sp If you attempt to import objects into an existing database, the result depends on the import format\&. If the format is \fBdefinitions\fR or \fBboth\fR, an error occurs unless \fB\-\-drop\-first\fR is given\&. If the format is \fBdata\fR, imported table data is added to existing table data\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-new\-storage\-engine= .sp The engine to use for all tables created on the destination server\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-no\-headers, \-h .sp Input does not contain column headers\&. This option applies only for \fBcsv\fR and \fBtab\fR output\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-quiet, \-q .sp Turn off all messages for quiet execution\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-server= .sp Connection information for the server in the format: <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] or <\fIlogin\-path\fR>[:<\fIport\fR>][:<\fIsocket\fR>]\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-skip= .sp Specify objects to skip in the operation as a comma\-separated list (no spaces)\&. Permitted values are \fBCREATE_DB\fR, \fBDATA\fR, \fBEVENTS\fR, \fBFUNCTIONS\fR, \fBGRANTS\fR, \fBPROCEDURES\fR, \fBTABLES\fR, \fBTRIGGERS\fR, and \fBVIEWS\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-skip\-blobs .sp Do not import BLOB data\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-skip\-gtid .sp Skip execution of GTID_PURGED statements\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-skip\-rpl .sp Do not execute replication commands\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-table=, .sp Specify the table for importing\&. This option is required while using \fB\-\-format=raw_csv\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-verbose, \-v .sp Specify how much information to display\&. Use this option multiple times to increase the amount of information\&. For example, \fB\-v\fR = verbose, \fB\-vv\fR = more verbose, \fB\-vvv\fR = debug\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-version .sp Display version information and exit\&. .RE NOTES .PP The login user must have the appropriate permissions to create new objects, access (read) the mysql database, and grant privileges\&. If a database to be imported already exists, the user must have read permission for it, which is needed to check the existence of objects in the database\&. .PP Actual privileges needed may differ from installation to installation depending on the security privileges present and whether the database contains certain objects such as views or events and whether binary logging is enabled\&. .PP Some combinations of the options may result in errors during the operation\&. For example, excluding tables but not views may result in an error when a view is imported\&. .PP The \fB\-\-new\-storage\-engine\fR and \fB\-\-default\-storage\-engine\fR options apply to all destination tables in the operation\&. .PP For the \fB\-\-format\fR and \fB\-\-import\fR options, the permitted values are not case sensitive\&. In addition, values may be specified as any unambiguous prefix of a valid value\&. For example, \fB\-\-format=g\fR specifies the grid format\&. An error occurs if a prefix matches more than one valid value\&. .PP When importing data and including the GTID commands, you may encounter an error similar to "GTID_PURGED can only be set when GTID_EXECUTED is empty"\&. This occurs because the destination server is not in a clean replication state\&. To aleviate this problem, you can issue a "RESET MASTER" command on the destination prior to executing the import\&. .PP The path to the MySQL client tools should be included in the PATH environment variable in order to use the authentication mechanism with login\-paths\&. This will allow the utility to use the my_print_defaults tools which is required to read the login\-path values from the login configuration file (\&.mylogin\&.cnf)\&. EXAMPLES .PP To import the metadata from the util_test database to the server on the local host using a file in CSV format, use this command: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbimport \-\-server=root@localhost \-\-import=definitions \e \-\-format=csv data\&.csv # Source on localhost: \&.\&.\&. connected\&. # Importing definitions from data\&.csv\&. #\&.\&.\&.done\&. .fi .if n \{\ .RE .\} .PP Similarly, to import the data from the util_test database to the server on the local host, importing the data using bulk insert statements, use this command: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbimport \-\-server=root@localhost \-\-import=data \e \-\-bulk\-insert \-\-format=csv data\&.csv # Source on localhost: \&.\&.\&. connected\&. # Importing data from data\&.csv\&. #\&.\&.\&.done\&. .fi .if n \{\ .RE .\} .PP To import both data and definitions from the util_test database, importing the data using bulk insert statements from a file that contains SQL statements, use this command: .sp .if n \{\ .RS 4 .\} .nf $ mysqldbimport \-\-server=root@localhost \-\-import=both \-\-bulk\-insert \-\-format=sql data\&.sql # Source on localhost: \&.\&.\&. connected\&. # Importing definitions and data from data\&.sql\&. #\&.\&.\&.done\&. .fi .if n \{\ .RE .\} .SH "COPYRIGHT" .br .SH "SEE ALSO" For more information, please refer to the MySQL Utilities section of the MySQL Workbench Reference Manual, which is available online at http://dev.mysql.com/doc/workbench/en/. .SH AUTHOR Oracle Corporation (http://dev.mysql.com/). mysql-utilities-1.3.5/docs/man/mysqlauditgrep.10000644001577100000120000010602412210044426021001 0ustar pb2userwheel'\" t .\" Title: \fBmysqlauditgrep\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 08/30/2013 .\" Manual: MySQL Utilities .\" Source: MySQL 1.3.4 .\" Language: English .\" .TH "\FBMYSQLAUDITGREP\FR" "1" "08/30/2013" "MySQL 1\&.3\&.4" "MySQL Utilities" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .\" mysqlauditgrep .\" utilities: mysqlauditgrep .\" scripts .SH "NAME" mysqlauditgrep \- Search an audit log .SH "SYNOPSIS" .HP \w'\fB\ mysqlauditgrep\ [\fR\fB\fIOPTIONS\fR\fR\fB]\&.\&.\&.\ \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB\ \fR\fB\ mysqlauditgrep\ \-\-file\-stats[\-\-format=\fR\fB\fIFORMAT\fR\fR\fB]\ \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB\ \fR\fB\ mysqlauditgrep\ \-\-format=\fR\fB\fIFORMAT\fR\fR\fB\ \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB\ \fR\fB\ mysqlauditgrep\ [\-\-users=\fR\fB\fIUSERS\fR\fR\fB]\ [\-\-start\-date=\fR\fB\fISTART_DATE\fR\fR\fB]\ [\-\-end\-date=\fR\fB\fIEND_DATE\fR\fR\fB]\ [\-\-pattern=\fR\fB\fIPATTERN\fR\fR\fB[\-\-regexp]]\ [\-\-query\-type=\fR\fB\fIQUERY_TYPE\fR\fR\fB]\ [\-\-event\-type=\fR\fB\fIEVENT_TYPE\fR\fR\fB]\ [\-\-status=\fR\fB\fISTATUS\fR\fR\fB]\ [\-\-format=\fR\fB\fIFORMAT\fR\fR\fB]\ \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB\ \fR\ 'u \fB mysqlauditgrep [\fR\fB\fIOPTIONS\fR\fR\fB]\&.\&.\&. \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB \fR\fB mysqlauditgrep \-\-file\-stats[\-\-format=\fR\fB\fIFORMAT\fR\fR\fB] \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB \fR\fB mysqlauditgrep \-\-format=\fR\fB\fIFORMAT\fR\fR\fB \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB \fR\fB mysqlauditgrep [\-\-users=\fR\fB\fIUSERS\fR\fR\fB] [\-\-start\-date=\fR\fB\fISTART_DATE\fR\fR\fB] [\-\-end\-date=\fR\fB\fIEND_DATE\fR\fR\fB] [\-\-pattern=\fR\fB\fIPATTERN\fR\fR\fB[\-\-regexp]] [\-\-query\-type=\fR\fB\fIQUERY_TYPE\fR\fR\fB] [\-\-event\-type=\fR\fB\fIEVENT_TYPE\fR\fR\fB] [\-\-status=\fR\fB\fISTATUS\fR\fR\fB] [\-\-format=\fR\fB\fIFORMAT\fR\fR\fB] \fR\fB\fIAUDIT_LOG_FILE\fR\fR\fB \fR .SH "DESCRIPTION" .PP This utility allows you to search the current or archived audit logs, allowing you to display data from the audit log file according to the defined search criterion\&. It also allows you to output the results in different formats, namely GRID (default), TAB, CSV, VERTICAL, and RAW (the original XML format)\&. .PP This utility allows you to search and filter the returned audit log records by: users (\fB\-\-users\fR), date and time ranges (\fB\-\-start\-date\fR and \fB\-\-end\-date\fR), SQL query types (\fB\-\-query\-type\fR), logged event and record types (\fB\-\-event\-type\fR), status (\fB\-\-status\fR), and matching patterns (\fB\-\-pattern\fR)\&. Any of these search options can be combined and used together, with the retrieved records resulting from all passed in options being true\&. .PP The \fB\-\-pattern\fR supports two types of pattern matching: standard SQL, used with the SQL \fILIKE\fR operator (SQL patterns), and standard \fIREGEXP\fR (POSIX regular expression patterns)\&. .PP This utility always requires an audit log file to be passed in, so the \fIAUDIT_LOG_FILE\fR argument is searched as a full path and file name for the audit log file\&. If not specified, a notification concerning this requirement will be printed\&. And if \fB\-\-format\fR is passed in without search parameters, then all the records of the audit log are displayed in the specified format\&. .PP The \fB\-\-file\-stats\fR option is not considered a search criteria, and is used to display the file statistics of a specified audit log\&. Other search options will be ignored when the \fB\-\-file\-stats\fR option is used, except the \fB\-\-format\fR option will continue to format the results accordingly\&. .PP To specify the format of the generated results, use one of the following values with the \fB\-\-format\fR option: .sp .RS 4 .ie n \{\ \h'-04' 1.\h'+01'\c .\} .el \{\ .sp -1 .IP " 1." 4.2 .\} \fIGRID (default)\fR .sp Display output in grid or table format like that of the \fBmysql\fR monitor\&. .RE .sp .RS 4 .ie n \{\ \h'-04' 2.\h'+01'\c .\} .el \{\ .sp -1 .IP " 2." 4.2 .\} \fICSV\fR .sp Display output in comma\-separated values format\&. .RE .sp .RS 4 .ie n \{\ \h'-04' 3.\h'+01'\c .\} .el \{\ .sp -1 .IP " 3." 4.2 .\} \fIVERTICAL\fR .sp Display output in single\-column format like that of the \eG command for the \fBmysql\fR monitor\&. .RE .sp .RS 4 .ie n \{\ \h'-04' 4.\h'+01'\c .\} .el \{\ .sp -1 .IP " 4." 4.2 .\} \fIRAW\fR .sp Display output results in the original raw format of the audit log records, which is written in XML\&. .RE Standard SQL Pattern Matching .PP The simple patterns defined by the SQL standard enables users to use two characters with special meanings: \(lq%\(rq (percent) matches zero or more characters, and \(lq_\(rq (underscore) matches exactly one arbitrary character\&. In standard SQL, these types of patterns are used with the LIKE comparison operator, and they are case\-insensitive by default\&. This utility assumes that they are case\-insensitive\&. .PP For example: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} "audit%" .sp Match any string that starts with "audit"\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} "%log%" .sp Match any string containing the word "log"\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} "%_" .sp Match any string consisting of one or more characters\&. .RE .PP For documentation about the standard SQL pattern matching syntax, see \m[blue]\fBPattern Matching\fR\m[]\&\s-2\u[1]\d\s+2\&. REGEXP Pattern Matching (POSIX) .PP Standard \fIREGEXP\fR patterns are more powerful than the simple patterns defined in the SQL standard\&. A regular expression is a string of ordinary and special characters specified to match other strings\&. Unlike SQL Patterns, \fIREGEXP\fR patterns are case\-sensitive\&. The \fIREGEXP\fR syntax defines the following characters with special meaning: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI\&.\fR .sp Match any character\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI^\fR .sp Match the beginning of a string\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI$\fR .sp Match the end of a string\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI\e\fR .sp Match zero or more repetitions of the preceding regular expression\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI+\fR .sp Match one or more repetitions of the preceding regular expression\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI?\fR .sp Match zero or one repetition of the preceding regular expression\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI|\fR .sp Match either the regular expressions from the left or right of |\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI[]\fR .sp Indicates a set of characters to match\&. Note that, special characters lose their special meaning inside sets\&. In particular, ^ acquires a different meaning if it is the first character of the set, matching the complementary set (i\&.e\&., all the characters that are not in the set will be matched)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI{m}\fR .sp Match \fIm\fR repetitions of the preceding regular expression\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI{m,n}\fR .sp Match from \fIm\fR to \fIn\fR repetitions of the preceding regular expression\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI()\fR .sp Define a matching group, and matches the regular expression inside the parentheses\&. .RE .PP For example: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI"a\e*"\fR .sp Match a sequence of zero or more a\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI"a+"\fR .sp Match a sequence of one or more a\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI"a?"\fR .sp Match zero or one a\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI"ab|cd"\fR .sp Match ab or cd\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI"[axy]"\fR .sp Match a, x or y\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI"[a\-f]"\fR .sp Match any character in the range a to f (that is, a, b, c, d, e, or f)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI"[^axy]"\fR .sp Match any character \fIexcept\fRa, x or y\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI"a{5}"\fR .sp Match exactly five copies of a\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI"a{2,5}"\fR .sp Match from two to five copies of a\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fI"(abc)+"\fR .sp Match one or more repetitions of abc\&. .RE .PP This is a brief overview of regular expressions that can be used to define this type of patterns\&. The full syntax is described in the \m[blue]\fBPython "re" module docs\fR\m[]\&\s-2\u[2]\d\s+2, supporting the definition of much more complex pattern matching expression\&. OPTIONS .PP \fBmysqlauditgrep\fR accepts the following command\-line options: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-end\-date= .sp End date/time to retrieve log entries until the specified date/time range\&. If not specified or the value is 0, all entries to the end of the log are displayed\&. Accepted formats: "yyyy\-mm\-ddThh:mm:ss" or "yyyy\-mm\-dd"\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-event\-type= .sp Comma\-separated list of event types to search in all audit log records matching the specified types\&. Supported values are: Audit, Binlog Dump, Change user, Close stmt, Connect Out, Connect, Create DB, Daemon, Debug, Delayed insert, Drop DB, Execute, Fetch, Field List, Init DB, Kill, Long Data, NoAudit, Ping, Prepare, Processlist, Query, Quit, Refresh, Register Slave, Reset stmt, Set option, Shutdown, Sleep, Statistics, Table Dump, Time\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-file\-stats .sp Display the audit log file statistics\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-format=FORMAT, \-f FORMAT .sp Output format to display the resulting data\&. Supported format values: GRID (default), TAB, CSV, VERTICAL and RAW\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-help .sp Display a help message and exit\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-pattern=, \-e .sp Search pattern to retrieve all entries with at least one attribute value matching the specified pattern\&. By default the standard SQL \fILIKE\fR patterns are used for matching\&. If the \fB\-\-regexp\fR option is set, then \fIREGEXP\fR patterns must be specified for matching\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-query\-type= .sp Comma\-separated list of SQL statements/commands to search for and match\&. Supported values: CREATE, ALTER, DROP, TRUNCATE, RENAME, GRANT, REVOKE, SELECT, INSERT, UPDATE, DELETE, COMMIT, SHOW, SET, CALL, PREPARE, EXECUTE, DEALLOCATE\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-regexp, \-\-basic\-regexp, \-G .sp Indicates that pattern matching will be performed using a regular expression \fIREGEXP\fR (from the Python re module)\&. By default, the simple standard SQL \fILIKE\fR patterns are used for matching\&. This affects how the value specified by the \fB\-\-pattern\fR option is interpreted\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-start\-date= .sp Starting date/time to retrieve log entries from the specified date/time range\&. If not specified or the value is 0, all entries from the start of the log are displayed\&. Accepted formats: yyyy\-mm\-ddThh:mm:ss or yyyy\-mm\-dd\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-status= .sp Comma\-separated list of status values or intervals to search for all audit log records with a matching status\&. Status values are non\-negative integers (corresponding to MySQL error codes)\&. Status intervals are closed (i\&.e\&., include both endpoints) and defined simply using a dash between its endpoints\&. For Example: 1051,1068\-1075,1109,1146\&. .sp The \-\-status option is available as of MySQL Utilities 1\&.2\&.4 / 1\&.3\&.3\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-users=, \-u .sp Comma\-separated list of user names, to search for their associated log entries\&. For example: "dan,jon,john,paul,philip,stefan"\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-verbose, \-v .sp Specify how much information to display\&. Use this option multiple times to increase the amount of information\&. For example, \fB\-v\fR = verbose, \fB\-vv\fR = more verbose, \fB\-vvv\fR = debug\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-version .sp Display version information and exit\&. .RE NOTES .PP This utility is available as of μ 1\&.2\&.0\&. .PP This utility can only be applied to servers with the \m[blue]\fBaudit log plugin enabled\fR\m[]\&\s-2\u[3]\d\s+2\&. And the audit log plugin is available as of MySQL Server versions 5\&.5\&.28 and 5\&.6\&.10\&. .PP This utility requires the use of Python version 2\&.6 or higher, but does not support Python 3\&. .PP Single or double quote characters (respectively, \fI\*(Aq\fR or \fI"\fR) can be used around option values\&. In fact, quotes are required to set some options values correctly, such as values with whitespace\&. For example, to specify the event types \fBCreate DB\fR and \fBDrop DB\fR for the \fB\-\-event\-type\fR option, the following syntax must be used: \fB\-\-event\-type=\*(AqCreate DB,Drop DB\*(Aq\fR or \fB\-\-event\-type="Create DB,Drop DB"\fR\&. EXAMPLES .PP To display the audit log file statistics and output the results in CSV format, run the following command: .sp .if n \{\ .RS 4 .\} .nf shell> mysqlauditgrep \-\-file\-stats \-\-format=CSV /SERVER/data/audit\&.log # # Audit Log File Statistics: # File,Size,Created,Last Modified audit\&.log,9101,Thu Sep 27 13:33:11 2012,Thu Oct 11 17:40:35 2012 # # Audit Log Startup Entries: # SERVER_ID,STARTUP_OPTIONS,NAME,TIMESTAMP,MYSQL_VERSION,OS_VERSION,VERSION 1,/SERVER/sql/mysqld \-\-defaults\-file=/SERVER/my\&.cnf,Audit,2012\-09\-27T13:33:11,5\&.5\&.29\-log,x86_64\-Linux,1 .fi .if n \{\ .RE .\} .PP To display the audit log entries of specific users, use the following command: .sp .if n \{\ .RS 4 .\} .nf shell> mysqlauditgrep \-\-users=tester1,tester2 /SERVER/data/audit\&.log .fi .if n \{\ .RE .\} .PP To display the audit log file statistics, run the following command: .sp .if n \{\ .RS 4 .\} .nf shell> mysqlauditgrep \-\-users=tester1,tester2 /SERVER/data/audit\&.log +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | STATUS | SERVER_ID | NAME | TIMESTAMP | CONNECTION_ID | HOST | USER | PRIV_USER | IP | SQLTEXT | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | 0 | 1 | Connect | 2012\-09\-28T11:26:50 | 9 | localhost | root | tester1 | 127\&.0\&.0\&.1 | None | | 0 | 1 | Query | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | SET @@session\&.autocommit = OFF | | 0 | 1 | Ping | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | None | | 0 | 1 | Query | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | SHOW VARIABLES LIKE \*(AqREAD_ONLY\*(Aq | | 0 | 1 | Query | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | COMMIT | | 0 | 1 | Ping | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | None | | 0 | 1 | Query | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | COMMIT | | 0 | 1 | Quit | 2012\-09\-28T11:26:50 | 9 | None | root | tester1 | None | None | | 0 | 1 | Connect | 2012\-10\-10T15:55:55 | 11 | localhost | tester2 | root | 127\&.0\&.0\&.1 | None | | 0 | 1 | Query | 2012\-10\-10T15:55:55 | 11 | None | tester2 | root | None | select @@version_comment limit 1 | | 0 | 1 | Query | 2012\-10\-10T15:56:10 | 11 | None | tester2 | root | None | show databases | | 1046 | 1 | Query | 2012\-10\-10T15:57:26 | 11 | None | tester2 | root | None | show tables test | | 1046 | 1 | Query | 2012\-10\-10T15:57:36 | 11 | None | tester2 | root | None | show tables test | | 0 | 1 | Query | 2012\-10\-10T15:57:51 | 11 | None | tester2 | root | None | show tables in test | | 0 | 1 | Quit | 2012\-10\-10T15:57:59 | 11 | None | tester2 | root | None | None | | 0 | 1 | Connect | 2012\-10\-10T17:35:42 | 12 | localhost | tester2 | root | 127\&.0\&.0\&.1 | None | | 0 | 1 | Query | 2012\-10\-10T17:35:42 | 12 | None | tester2 | root | None | select @@version_comment limit 1 | | 0 | 1 | Quit | 2012\-10\-10T17:47:22 | 12 | None | tester2 | root | None | None | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .PP To display the audit log entries for a specific date/time range, use the following command: .sp .if n \{\ .RS 4 .\} .nf shell> mysqlauditgrep \-\-start\-date=2012\-09\-27T13:33:47 \-\-end\-date=2012\-09\-28 /SERVER/data/audit\&.log +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | STATUS | TIMESTAMP | NAME | CONNECTION_ID | SQLTEXT | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | 0 | 2012\-09\-27T13:33:47 | Ping | 7 | None | | 0 | 2012\-09\-27T13:33:47 | Query | 7 | SELECT * FROM INFORMATION_SCHEMA\&.PLUGINS WHERE PLUGIN_NAME LIKE \*(Aqaudit%\*(Aq | | 0 | 2012\-09\-27T13:33:47 | Query | 7 | COMMIT | | 0 | 2012\-09\-27T13:34:48 | Quit | 7 | None | | 0 | 2012\-09\-27T13:34:48 | Quit | 8 | None | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .PP To display the audit log entries matching a specific SQL \fILIKE\fR pattern, use the following command: .sp .if n \{\ .RS 4 .\} .nf shell> mysqlauditgrep \-\-pattern="% = ___"; /SERVER/data/audit\&.log +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | STATUS | TIMESTAMP | NAME | SQLTEXT | CONNECTION_ID | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 7 | | 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 8 | | 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 9 | | 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 10 | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .PP To display the audit log entries matching a specific \fIREGEXP \fR pattern, use the following command: .sp .if n \{\ .RS 4 .\} .nf shell> mysqlauditgrep \-\-pattern="\&.* = \&.\&.\&." \-\-regexp /SERVER/data/audit\&.log +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | STATUS | TIMESTAMP | NAME | SQLTEXT | CONNECTION_ID | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 7 | | 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 8 | | 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 9 | | 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 10 | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .PP To display the audit log entries of specific query types, use the following command: .sp .if n \{\ .RS 4 .\} .nf shell> mysqlauditgrep \-\-query\-type=show,SET /SERVER/data/audit\&.log +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | STATUS | TIMESTAMP | NAME | SQLTEXT | CONNECTION_ID | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | 0 | 2012\-09\-27T13:33:39 | Query | SET NAMES \*(Aqlatin1\*(Aq COLLATE \*(Aqlatin1_swedish_ci\*(Aq | 7 | | 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 7 | | 0 | 2012\-09\-27T13:33:39 | Query | SHOW VARIABLES LIKE \*(AqREAD_ONLY\*(Aq | 7 | | 0 | 2012\-09\-27T13:33:39 | Query | SHOW VARIABLES LIKE \*(Aqdatadir\*(Aq | 7 | | 0 | 2012\-09\-27T13:33:39 | Query | SHOW VARIABLES LIKE \*(Aqbasedir\*(Aq | 7 | | 0 | 2012\-09\-27T13:33:39 | Query | SET NAMES \*(Aqlatin1\*(Aq COLLATE \*(Aqlatin1_swedish_ci\*(Aq | 8 | | 0 | 2012\-09\-27T13:33:39 | Query | SET @@session\&.autocommit = OFF | 8 | | 0 | 2012\-09\-27T13:33:39 | Query | SHOW VARIABLES LIKE \*(AqREAD_ONLY\*(Aq | 8 | | 0 | 2012\-09\-27T13:33:39 | Query | SHOW VARIABLES LIKE \*(Aqbasedir\*(Aq | 8 | | 0 | 2012\-09\-28T11:26:50 | Query | SET NAMES \*(Aqlatin1\*(Aq COLLATE \*(Aqlatin1_swedish_ci\*(Aq | 9 | | 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 9 | | 0 | 2012\-09\-28T11:26:50 | Query | SHOW VARIABLES LIKE \*(AqREAD_ONLY\*(Aq | 9 | | 0 | 2012\-09\-28T11:26:50 | Query | SET NAMES \*(Aqlatin1\*(Aq COLLATE \*(Aqlatin1_swedish_ci\*(Aq | 10 | | 0 | 2012\-09\-28T11:26:50 | Query | SET @@session\&.autocommit = OFF | 10 | | 0 | 2012\-09\-28T11:26:50 | Query | SHOW VARIABLES LIKE \*(AqREAD_ONLY\*(Aq | 10 | | 0 | 2012\-09\-28T11:26:50 | Query | SET @@GLOBAL\&.audit_log_flush = ON | 10 | | 0 | 2012\-09\-28T11:26:50 | Query | SHOW VARIABLES LIKE \*(Aqaudit_log_policy\*(Aq | 10 | | 0 | 2012\-09\-28T11:26:50 | Query | SHOW VARIABLES LIKE \*(Aqaudit_log_rotate_on_size\*(Aq | 10 | | 0 | 2012\-10\-10T15:56:10 | Query | show databases | 11 | | 1046 | 2012\-10\-10T15:57:26 | Query | show tables test | 11 | | 1046 | 2012\-10\-10T15:57:36 | Query | show tables test | 11 | | 0 | 2012\-10\-10T15:57:51 | Query | show tables in test | 11 | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .PP To display the audit log entries of specific event types, use the following command: .sp .if n \{\ .RS 4 .\} .nf shell> mysqlauditgrep \-\-event\-type="Ping,Connect" /SERVER/data/audit\&.log +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+ | STATUS | NAME | TIMESTAMP | CONNECTION_ID | HOST | USER | PRIV_USER | IP | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+ | 0 | Connect | 2012\-09\-27T13:33:39 | 7 | localhost | root | root | 127\&.0\&.0\&.1 | | 0 | Ping | 2012\-09\-27T13:33:39 | 7 | None | None | None | None | | 0 | Ping | 2012\-09\-27T13:33:39 | 7 | None | None | None | None | | 0 | Ping | 2012\-09\-27T13:33:39 | 7 | None | None | None | None | | 0 | Ping | 2012\-09\-27T13:33:39 | 7 | None | None | None | None | | 0 | Connect | 2012\-09\-27T13:33:39 | 8 | localhost | root | root | 127\&.0\&.0\&.1 | | 0 | Ping | 2012\-09\-27T13:33:39 | 8 | None | None | None | None | | 0 | Ping | 2012\-09\-27T13:33:39 | 8 | None | None | None | None | | 0 | Ping | 2012\-09\-27T13:33:47 | 7 | None | None | None | None | | 0 | Connect | 2012\-09\-28T11:26:50 | 9 | localhost | root | tester | 127\&.0\&.0\&.1 | | 0 | Ping | 2012\-09\-28T11:26:50 | 9 | None | None | None | None | | 0 | Ping | 2012\-09\-28T11:26:50 | 9 | None | None | None | None | | 0 | Connect | 2012\-09\-28T11:26:50 | 10 | localhost | root | root | 127\&.0\&.0\&.1 | | 0 | Ping | 2012\-09\-28T11:26:50 | 10 | None | None | None | None | | 0 | Ping | 2012\-09\-28T11:26:50 | 10 | None | None | None | None | | 0 | Ping | 2012\-09\-28T11:26:50 | 10 | None | None | None | None | | 0 | Ping | 2012\-09\-28T11:26:50 | 10 | None | None | None | None | | 0 | Ping | 2012\-09\-28T11:26:50 | 10 | None | None | None | None | | 0 | Connect | 2012\-10\-10T15:55:55 | 11 | localhost | tester | root | 127\&.0\&.0\&.1 | | 0 | Connect | 2012\-10\-10T17:35:42 | 12 | localhost | tester | root | 127\&.0\&.0\&.1 | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .PP To display the audit log entries with a specific status, use the following command: .sp .if n \{\ .RS 4 .\} .nf shell> mysqlauditgrep \-\-status=1100\-1199,1046 /SERVER/data/audit\&.log +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | STATUS | TIMESTAMP | NAME | SQLTEXT | CONNECTION_ID | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | 1046 | 2012\-10\-10T15:57:26 | Query | show tables test | 11 | | 1046 | 2012\-10\-10T15:57:36 | Query | show tables test | 11 | | 1146 | 2012\-10\-10T17:44:55 | Query | select * from teste\&.employees where salary > 500 and salary < 1000 | 12 | | 1046 | 2012\-10\-10T17:47:17 | Query | select * from test_encoding where value = \*(Aq<>"&\*(Aq | 12 | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .PP Note: You can view all successful commands with \fB\-\-status=0\fR and all unsuccessful ones with \fB\-\-status=1\-9999\fR\&. .PP To display the audit log entries matching several search criteria, use the following command: .sp .if n \{\ .RS 4 .\} .nf shell> mysqlauditgrep \-\-users=root \-\-start\-date=0 \-\-end\-date=2012\-10\-10 \-\-event\-type=Query \e \-\-query\-type=SET \-\-status=0 \-\-pattern="%audit_log%" /SERVER/data/audit\&.log +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | STATUS | SERVER_ID | NAME | TIMESTAMP | CONNECTION_ID | USER | PRIV_USER | SQLTEXT | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | 0 | 1 | Query | 2012\-09\-28T11:26:50 | 10 | root | root | SET @@GLOBAL\&.audit_log_flush = ON | +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .SH "COPYRIGHT" .br .SH "NOTES" .IP " 1." 4 Pattern Matching .RS 4 \%http://dev.mysql.com/doc/refman/5.6/en/pattern-matching.html .RE .IP " 2." 4 Python "re" module docs .RS 4 \%http://docs.python.org/2/library/re.html .RE .IP " 3." 4 audit log plugin enabled .RS 4 \%http://dev.mysql.com/doc/refman/5.6/en/audit-log-plugin-installation.html .RE .SH "SEE ALSO" For more information, please refer to the MySQL Utilities section of the MySQL Workbench Reference Manual, which is available online at http://dev.mysql.com/doc/workbench/en/. .SH AUTHOR Oracle Corporation (http://dev.mysql.com/). mysql-utilities-1.3.5/docs/man/mysqlfailover.10000644001577100000120000010103312210044426020617 0ustar pb2userwheel'\" t .\" Title: \fBmysqlfailover\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 08/30/2013 .\" Manual: MySQL Utilities .\" Source: MySQL 1.3.4 .\" Language: English .\" .TH "\FBMYSQLFAILOVER\FR" "1" "08/30/2013" "MySQL 1\&.3\&.4" "MySQL Utilities" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .\" mysqlfailover .\" utilities: mysqlfailover .\" scripts .SH "NAME" mysqlfailover \- Automatic replication failover .SH "SYNOPSIS" .HP \w'\fBmysqlfailover\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u \fBmysqlfailover [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP This utility permits users to perform replication health monitoring and automatic failover on a replication topology consisting of a master and its slaves\&. The utility is designed to run interactively or continuously refreshing the health information at periodic intervals\&. Its primary mission is to monitor the master for failure and when a failure occurs, execute failover to the best slave available\&. The utility accepts a list of slaves to be considered the candidate slave\&. .PP This utility is designed to work exclusively for servers that support global transaction identifiers (GTIDs) and have GTID_MODE=ON\&. MySQL server versions 5\&.6\&.9 and higher support GTIDs\&. See the MySQL server online reference manual for more information about setting up replication with GTIDs enabled\&. .PP The user can specify the interval in seconds to use for detecting the master status and generating the health report using the \fB\-\-interval\fR option\&. At each interval, the utility will check to see if the server is alive via a ping operation followed by a check of the connector to detect if the server is still reachable\&. The ping operation can be controlled with the \fB\-\-ping\fR option (see below)\&. .PP If the master is found to be offline or unreachable, the utility will execute one of the following actions based on the value of the \fB\-\-failover\-mode\fR option\&. .PP \fBauto\fR Execute automatic failover to the list of candidates first and if no slaves are viable, continue to locate a viable candidate from the list of slaves\&. If no slaves are found to be a viable candidate, the utility will generate and error and exit\&. .PP Once a candidate is found, the utility will conduct failover to the best slave\&. The command will test each candidate slave listed for the prerequisites\&. Once a candidate slave is elected, it is made a slave of each of the other slaves thereby collecting any transactions executed on other slaves but not the candidate\&. In this way, the candidate becomes the most up\-to\-date slave\&. .PP \fBelect\fR This mode is the same as auto except if no candidates specified in the list of candidate slaves are viable, it does not check the remaining slaves and generates and error and exits\&. .PP \fBfail\fR This mode produces an error and does not failover when the master is downed\&. This mode is used to provide periodic health monitoring without the failover action taken\&. .PP For all options that permit specifying multiple servers, the options require a comma\-separated list of connection parameters in the following form (where the password, port, and socket are optional)\&.: .sp .if n \{\ .RS 4 .\} .nf <*user*>[:<*passwd*>]@<*host*>[:<*port*>][:<*socket*>] or <*login\-path*>[:<*port*>][:<*socket*>] .fi .if n \{\ .RE .\} .PP The utility permits users to discover slaves connected to the master\&. In order to use the discover slaves feature, all slaves must use the \-\-report\-host and \-\-report\-port startup variables to specify the correct hostname and ip port of the slave\&. If these are missing or report the incorrect information, the slaves health may not be reported correctly or the slave may not be listed at all\&. The discover slaves feature ignores any slaves it cannot connect to\&. .PP The discover slaves feature is run automatically on each interval\&. .PP The utility permits the user to specify an external script to execute before and after the switchover and failover commands\&. The user can specify these with the \fB\-\-exec\-before\fR and \fB\-\-exec\-after\fR options\&. The return code of the script is used to determine success thus each script must report 0 (success) to be considered successful\&. If a script returns a value other than 0, the result code is presented in an error message\&. .PP The utility also permits the user to specify a script to be used for detecting a downed master or an application\-level event to trigger failover\&. This can be specified using the \fB\-\-exec\-fail\-check\fR option\&. The return code for the script is used to invoke failover\&. A return code of 0 indicates failover should not take place\&. A return code other than 0 indicates failover should take place\&. This is checked at the start of each interval if a script is supplied\&. The timeout option is not used in this case and the script is run once at the start of each interval\&. .PP The utility permits the user to log all actions taken during the commands\&. The \fB\-\-log\fR option requires a valid path and file name of the file to use for logging operations\&. The log is active only when this option is specified\&. The option \fB\-\-log\-age\fR specifies the age in days that log entries are kept\&. The default is seven (7) days\&. Older entries are automatically deleted from the log file (but only if the \fB\-\-log\fR option is specified)\&. .PP The format of the log file includes the date and time of the event, the level of the event (informational \- INFO, warning \- WARN, error \- ERROR, critical failure \- CRITICAL), and the message reported by the utility\&. .PP The interface provides the user with a number of options for displaying additional information\&. The user can choose to see the replication health report (default), or choose to see the list of GTIDs in use, the UUIDs in use, and if logging is enabled the contents of the log file\&. Each of these reports is described below\&. .PP \fBhealth\fR Display the replication health of the topology\&. This report is the default view for the interface\&. By default, this includes the host name, port, role (MASTER or SLAVE) of the server, state of the server (UP = is connected, WARN = not connected but can ping, DOWN = not connected and cannot ping), the GTID_MODE, and health state\&. .PP The master health state is based on the following; if GTID_MODE=ON, the server must have binary log enabled, and there must exist a user with the REPLICATE SLAVE privilege\&. .PP The slave health state is based on the following; the IO_THREAD and SQL_THREADS must be running, it must be connected to the master, there are no errors, the slave delay for non\-gtid enabled scenarios is not more than the threshold provided by the \fB\-\-max\-position\fR and the slave is reading the correct master log file, and slave delay is not more than the \fB\-\-seconds\-behind\fR threshold option\&. .PP At each interval, if the discover slaves option was specified at startup and new slaves are discovered, the health report is refreshed\&. .PP \fBgtid\fR: Display the master\*(Aqs list of executed GTIDs, contents of the GTID variables; @@GLOBAL\&.GTID_EXECUTED, @@GLOBAL\&.GTID_PURGED, and @@GLOBAL\&.GTID_OWNED\&. Thus, the user can toggle through four screens by pressing the \*(AqG\*(Aq key repeatedly\&. The display will cycle through all four screens restarting after the fourth screen\&. .PP \fBUUID\fR: Display universally unique identifiers (UUIDs) for all servers\&. .PP \fBLog\fR: This option is visible only if the \fB\-\-log\fR option is specified\&. Show the contents of the log file\&. This can be helpful to see at a later time when failover occurred and the actions or messages recorded at the time\&. .PP The user interface is designed to match the size of the terminal window in which it is run\&. A refresh option is provided to permit users to resize their terminal windows or refresh the display at any time\&. However, the interface will automatically resize to the terminal window on each interval\&. .PP The interface will display the name of the utility, the master\*(Aqs status including binary log file, position, and filters as well as the date and time of the next interval event\&. .PP The interface will also permit the user to scroll up or down through a list longer than what the terminal window permits\&. When a long list is presented, the scroll options become enabled\&. The user can scroll the list up with the up arrow key and down with the down arrow key\&. .PP Use the \fB\-\-verbose\fR option to see additional information in the health report and additional messages during failover\&. .PP The utility supports two modes of operation\&. The default mode, running as a console, works as described above\&. An additional mode that permits you to run the utility as a daemon is provided for POSIX platforms\&. .PP When run as a daemon, the utility does not have interactivity\&. However, all events are written to the log file\&. You can control what is written to the log by using the \fB\-\-report\-values\fR option\&. .PP To run the utility as a daemon, use the \fB\-\-daemon\fR option\&. There are three commands that can by used in \fB\-\-daemon\fR option\&. These include: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} start .sp Starts the daemon\&. The \fB\-\-log\fR option is required\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} stop .sp Stops the daemon\&. If you used the option \fB\-\-pidfile\fR, the value must be the same when starting the daemon\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} restart .sp Restarts the daemon\&. If you used the option \fB\-\-pidfile\fR, the value must be the same when starting the daemon\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} nodetach .sp Starts the daemon, but it will not detach the process from the console\&. The \fB\-\-log\fR option is required\&. .RE .PP The utility supports two modes of operation\&. The default mode, running as a console, works as described above\&. An additional mode that permits you to run the utility as a daemon is provided for POSIX platforms\&. .PP When run as a daemon, the utility does not have interactivity\&. However, all events are written to the log file\&. You can control what is written to the log by using the \fB\-\-report\-values\fR option\&. .PP To run the utility as a daemon, use the \fB\-\-daemon\fR option\&. There are three commands that can by used in \fB\-\-daemon\fR option\&. These include: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} start .sp Starts the daemon\&. The \fB\-\-log\fR option is required\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} stop .sp Stops the daemon\&. The option \fB\-\-pidfile\fR must be the same when starting the daemon\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} restart .sp Restarts the daemon\&. The option \fB\-\-pidfile\fR must be the same when starting the daemon\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} nodetach .sp Starts the daemon, but it will not detach the process from the console\&. The \fB\-\-log\fR option is required\&. .RE OPTIONS .PP \fBmysqlfailover\fR accepts the following command\-line options: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-help .sp Display a help message and exit\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-candidates= .sp Connection information for candidate slave servers for failover in the form: <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] or <\fIlogin\-path\fR>[:<\fIport\fR>][:<\fIsocket\fR>]\&. Valid only with failover command\&. List multiple slaves in comma\-separated list\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-daemon= .sp Run as a daemon\&. It can be \fBstart\fR (start daemon), \fBstop\fR (stop daemon), \fBrestart\fR (stop then start the daemon) or \fBnodetach\fR (start but do not detach the process)\&. This option is only available for POSIX systems\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-discover\-slaves\-login= .sp At startup, query master for all registered slaves and use the user name and password specified to connect\&. Supply the user and password in the form <\fIuser\fR>[:<\fIpasswd\fR>] or <\fIlogin\-path\fR>\&. For example, \-\-discover=joe:secret will use \*(Aqjoe\*(Aq as the user and \*(Aqsecret\*(Aq as the password for each discovered slave\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-exec\-after=