Showing posts with label MySQL utilities. Show all posts
Showing posts with label MySQL utilities. Show all posts

April 13, 2023

MySQL Router mysqlrouter commands

MySQL Router


MySQL Router is part of the InnoDB Cluster and is lightweight middleware to provide transparent routing between applications and MySQL Servers.

mysqlrouter --help

mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/router
mysqlrouter --bootstrap localhost:3310 --directory /opt/myrouter --user snoopy
mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter -conf-use-sockets --account routerfriend --account-create always

mysqlrouter --bootstrap foo@bar.com --connect-timeout=20
mysqlrouter --bootstrap foo@bar.com --conf-set-option=logger.level=debug --conf-set-option=DEFAULT.unknown_config_option=warning --conf-set-option=DEFAULT.connect_timeout=20 --connect-timeout=10

mysqlrouter --bootstrap=127.0.0.1:3310 --master-key-reader=./reader.sh   --master-key-writer=./writer.sh
mysqlrouter --bootstrap localhost:3310 --account-host host1 --account-host host2  --account-host host3
mysqlrouter --bootstrap root@localhost:3310 --conf-base-port 0

mysqlrouter -c /tmp/myrouter/mysqlrouter.conf
mysqlrouter --config /custom/path/to/router.conf --extra-config /another/config.conf

Related MySQL Articles: mysqlsh - MySQL Shell utility

December 20, 2019

MySQL mysql_upgrade utility

mysql_upgrade utility examples

mysql_upgrade - check and upgrade MySQL tables

mysql_upgrade --help

mysql_upgrade --verbose other-options

mysql_upgrade -uroot -p

mysql_upgrade --protocol=tcp -P 3306

mysql_upgrade --login-path=admin

mysql_upgrade [--force] [--user=# --password --host=hostname --port=# --socket=# --protocol=tcp|socket|pipe|memory --verbose] OTHER_OPTIONS]


Related MySQL Articles: 

September 19, 2019

MySQL mysqlbinlogmove utility commands

mysqlbinlogmove cheatsheet

mysqlbinlogmove - binary log relocate utility

Usage: mysqlbinlogmove --server=user:pass@host:port destination_directory

In MySQL, mysqlbinlogmove utility used to relocate or move binary logs to a different location.

mysqlbinlogmove --version
mysqlbinlogmove --help

mysqlbinlogmove --server=user:pass@localhost:3311 /mysql/archive/binlog_dir
mysqlbinlogmove --binlog-dir=/server/data /new/binlog_dir
mysqlbinlogmove --server=user:pass@localhost:3310 --log-type=relay /mysql/archive/slave/binlog_dir
mysqlbinlogmove --server=dba --log-type=all --skip-flush-binlogs /mysql/archive/slave/binlog_dir --verbose
mysqlbinlogmove --server=user:pass@localhost:3312 --log-type=all --sequence=2,4-7,11,13 /mysql/archive/slave/binlog_dir
mysqlbinlogmove --server=mydba --log-type=all --modified-before=2 /mysql/archive/slave/binlog_dir
mysqlbinlogmove --server=user@localhost:3313 --log-type=all --modified-before=2019-08-31 /mysql/archive/slave/binlog_dir -vv

mysqlbinlogmove Options:
  --version             show program's version number and exit
  --help                 display a help message and exit
  --license             display program's license and exit
  --server=SERVER       connection information for the server in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config- path[[group]].
  --ssl-ca=SSL_CA        path to a file that contains a list of trusted SSL CAs.
  --ssl-cert=SSL_CERT  name of the SSL certificate file to use for establishing a secure connection.
  --ssl-key=SSL_KEY     name of the SSL key file to use for establishing a secure connection.
  --ssl=SSL             specifies if the server connection requires use of SSL. If an encrypted connection cannot be established, the connection attempt fails. By default 0 (SSL not required).
  --binlog-dir=BINLOG_DIR  Source directory (full path) where the binary log files to move are located.
  --bin-log-basename=BIN_LOG_BASENAME  Basename for the binlog files. If not available it is assumed to be any name ended with '-bin'.
  --relay-log-basename=RELAY_LOG_BASENAME Basename for the relay log files. If not available it is assumed to be any name ended with '-relay-bin'.
  --bin-log-index=BIN_LOG_INDEX  Location (full path) of the binlogs index file. If not specified it is assumed to be located in the binary log directory.
  --relay-log-index=RELAY_LOG_INDEX Location (full path) of the relay logs index file. If not specified it is assumed to be located in the binary log directory.
  -v, --verbose         control how much information is displayed. e.g., -v = verbose, -vv = more verbose, -vvv = debug
  --log-type=LOG_TYPE   type of the binary log files to relocate: 'bin' - bin- log files (default), 'relay' - relay-log files, 'all' - bin-log and relay-log files.
  --sequence=SEQUENCE   relocate files with the specified sequence values. Accepts a comma-separated list of non-negative integers (corresponding to the file sequence number) or intervals marked with a dash. For example: 3,5-12,16,21.
  --modified-before=MODIFIED_BEFORE relocate files with the modified date prior to the specified date/time or number of days. Accepts a date/time in the format: yyyy-mm-ddThh:mm:ss or yyyy- mm-dd, or an integer for the elapsed days.
  --skip-flush-binlogs  Skip the binary/relay flush operation to reload server's cache after moving files.

Introduction
------------
The mysqlbinlogmove utility was designed to relocate binary log files to a new location in a simple and easy way. The use of this utility is recommended when you intend to change the base location for the binlog files (enabled with the server option --log-bin) moving all binlog files to the target location and updating all required index files. It is also useful to archive some binary log files to a different location.

Note: In order to relocate all binary log files the mysql server must be stopped. This requirement is not needed if only some of binary log files are relocated.

The behaviour of the utility depends on the options specified. Use the --binlog_dir option to relocate all binary logs. Use the --server option to relocate all binary logs except the ones currently in use (with the higher sequence number). The target destination directory must be specified as an argument and other option can be used to restrict the binary log files that will be moved, as shown in the following examples.

  # Move all binlog files to a new location (from /old/location to /new/location).

  $ mysqlbinlogmove --binlog-dir=/old/location /new/location

  # Move all binlog files except the one currently in use to a new
  # location (from the server log_bin_basename directory to /new/location).

  $ mysqlbinlogmove --server=root:pass@host1:3306 /new/location

  # Move all binlog files within a specific sequence range (10-100),
  # except the one currently in use, to a new location (from the server log_bin_basename directory to /new/location).

  $ mysqlbinlogmove --server=root:pass@host1:3306 --sequence=10-100 /new/location

  # Move all binlog files not modified in the last two days, except the one
  # currently in use, to a new location (from the server log_bin_basename directory to /new/location).

  $ mysqlbinlogmove --server=root:pass@host1:3306 --modified-before=2 /new/location

  # Move all binlog files older than a specific date (not modified),
  # except the one currently in use, to a new location (from the server log_bin_basename directory to /new/location).

  $ mysqlbinlogmove --server=root:pass@host1:3306 --modified-before=2019-07-30 /new/location

Helpful Hints
-------------
  - By default only binlog files are moved. To move relay log files or both  use the --log-type option with the desired value.
  - By default the utility will try to automatically determine the base name for the binary logs and index files by applying the default filename
    formats and files location. If custom file names are used, you can specify them using the options --bin-log-index, --bin-log-basename,
    --relay-log-index, and --relay-log-basename, respectively for binlog and relay log files.
  - When the --server option is used by default binary logs are flushed at the end of the relocate operation in order to update the server's info. Use
    --skip-flush-binlogs to skip this step.

Related MySQL Articles: 

August 27, 2019

mysqlbinlogrotate utility commands

MySQL utility mysqlbinlogrotate

mysqlbinlogrotate - rotates the active binary log file

mysqlbinlogrotate utility rotates MySQL binary log files by closing the active binary log file and opening a new binary log file.

Usage: mysqlbinlogrotate --server=user:pass@host:port

mysqlbinlogrotate --help
mysqlbinlogrotate --version

mysqlbinlogrotate --server=root:root@localhost:3311 -v
mysqlbinlogrotate --server=root:root@localhost:3313 --min-size=2073741824 --verbose

mysqlbinlogrotate --server=mysqlhost3312
mysqlbinlogrotate --server=mysqldba --min-size=1073741824 -vv

mysql binlog rotate utility Options:
  --version            show program's version number and exit
  --help                display a help message and exit
  --license            display program's license and exit
  --server=SERVER      connection information for the server in the form: user[:password]@host[:port][:socket] or  login-path[:port][:socket] or config-path[[group]].
  --ssl-ca=SSL_CA      path to a file that contains a list of trusted SSL CAs.
  --ssl-cert=SSL_CERT  name of the SSL certificate file to use for  establishing a secure connection.
  --ssl-key=SSL_KEY    name of the SSL key file to use for establishing a secure connection.
  --ssl=SSL            specifies if the server connection requires use of SSL. If an encrypted connection cannot be established, the  connection attempt fails. By default 0 (SSL not required).
  --min-size=MIN_SIZE  rotate the active binlog file only if the file size exceeds the specified value in bytes.
  -v, --verbose        control how much information is displayed. e.g., -v = verbose, -vv = more verbose, -vvv = debug

Introduction
------------
The mysqlbinlogrotate utility was designed to rotate the active binary log.

The following are examples of use:
  # Rotate the active binary log from a server.
  $ mysqlbinlogrotate --server=root:pass@host1:3306

  # Rotate the active binary log from a server if the active binlog is bigger than 1MB or 1048576 bytes.
  $ mysqlbinlogrotate --server=root:pass@host1:3306 --min-size=1048576


Related MySQL Articles: Cheatsheet of mysqlbinlog utility

August 11, 2019

MySQL utility mysqlbinlogpurge usage examples

Cheatsheet of mysqlbinlogpurge - MySQL utility

mysqlbinlogpurge - purges unnecessary/old MySQL binary log files

Usage: mysqlbinlogpurge --master=user:pass@host:port --slaves=user:pass@host:port,user:pass@host:port

mysqlbinlogpurge utility used to purge/delete binary logs after ensuring that any files which are required by any of the slaves in a replication topology are not deleted.

mysqlbinlogpurge --version
mysqlbinlogpurge --hep

mysqlbinlogpurge --master=root:root@localhost:3310 --slaves=root:root@localhost:3311,root:root@localhost:3312,root:root@localhost:3313 -vv
mysqlbinlogpurge --master=mydba --slaves=root:root@localhost:3311,root:root@localhost:3312,root:root@localhost:3313 --binlog=mysql-bin.000033 -v

mysqlbinlogpurge --server=root:root@localhost:3310 --dry-run

mysql binlog purge Options:
  --version             show program's version number and exit
  --help                 display a help message and exit
  --license             display program's license and exit
  --server=SERVER       connection information for the server in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config- path[[group]].

  --ssl-ca=SSL_CA       path to a file that contains a list of trusted SSL   CAs.
  --ssl-cert=SSL_CERT   name of the SSL certificate file to use for  establishing a secure connection.
  --ssl-key=SSL_KEY     name of the SSL key file to use for establishing a  secure connection.
  --ssl=SSL             specifies if the server connection requires use of SSL. If an encrypted connection cannot be established, the connection attempt fails. By default 0 (SSL not required).

  -d, --dry-run         run the utility without purge any binary log, instead  it will print the unused binary log files.
  --binlog=BINLOG       Binlog file name to keep (not to purge). All the binary log files prior to the specified file will be removed.
  --discover-slaves-login=DISCOVER 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 user[:password] or login-path. For example, --discover-slaves-login=joe:secret will use 'joe' as the user and 'secret' as the password for each discovered slave.

  --master=MASTER       connection information for master server in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config- path[[group]].
  --slaves=SLAVES       connection information for slave servers in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config- path[[group]]. List multiple slaves in comma- separated list.
  -v, --verbose         control how much information is displayed. e.g., -v =  verbose, -vv = more verbose, -vvv = debug

Introduction
------------
The mysqlbinlogpurge utility was designed to purge binary log files in a replication scenario operating in a safe manner by prohibiting deletion of binary log files that are open or which are required by a slave (have not been read by the slave). The utility verifies the latest binary log file that has been read by all the slave servers to determine the binary log files that can be deleted.

Note: In order to determine the latest binary log file that has been replicated by all the slaves, they must be connected to the master at the time the utility is executed.

The following are examples of use:
  # Purge all the binary log files prior to a specified file for a standalone
  # server.
  $ mysqlbinlogpurge --server=root:pass@host1:3306 --binlog=bin-log.001302

  # Display the latest binary log that has been replicated by all specified
  # slaves in a replication scenario.
  $ mysqlbinlogpurge --master=root:pass@host2:3306 --slaves=root:pass@host3:3308,root:pass@host3:3309 --dry-run


Related MySQL Articles: 

June 20, 2019

mysqlmetagrep utility commands in MySQL database

MySQL utility - mysqlmetagrep

mysqlmetagrep     search metadata/Database Object Definitions   

MySQL mysqlmetagrep utility searches for objects matching a given pattern on all the servers specified using instances mentioned in command line. And displays the matching objects.

Usage: mysqlmetagrep --server=user:pass@host:port:socket [options] pattern

mysqlmetagrep --help
mysqlmetagrep --version

mysqlmetagrep --pattern="CountryCode" --server=root:secret@localhost
mysqlmetagrep --pattern="t_" --server=dba

mysqlmetagrep -b --pattern="%t2%" --server=test@localhost:3308
mysqlmetagrep -Gb --pattern="t2" --server=mysql_dba

mysqlmetagrep --server=root:secret@localhost --pattern=host --search=column
mysqlmetagrep --server=root:secret@localhost:3310 --pattern='innodb%' --format=vertical

mysqlmetagrep --server=dba -e '%memory%thread%' --database=sys --search-objects=view -f vertical

mysqlmetagrep Options:
  --version             show program's version number and exit
  --help                 display a help message and exit
  --license             display program's license and exit
  --server=SERVER       connection information for the server in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config-path[[group]].

  --ssl-ca=SSL_CA         path to a file that contains a list of trusted SSL     CAs.
  --ssl-cert=SSL_CERT   name of the SSL certificate file to use for    establishing a secure connection.
  --ssl-key=SSL_KEY     name of the SSL key file to use for establishing a  secure connection.
  --ssl=SSL             specifies if the server connection requires use of  SSL. If an encrypted connection cannot be established, the connection attempt fails. By default 0 (SSL not required).

  --character-set=CHARSET  sets the client character set. The default is  retrieved from the server variable  'character_set_client'.
  -b, --body            search the body of routines, triggers, and events as   well
  --search-objects=OBJECT_TYPES, --object-types=OBJECT_TYPES   the object type to search in: a comma-separated list of one or more of: 'database', 'trigger', 'user', 'routine', 'column', 'table', 'partition', 'event', 'view'
  -G, --basic-regexp, --regexp   use 'REGEXP' operator to match pattern. Default is to  use 'LIKE'.

  -p, --print-sql, --sql     print the statement instead of sending it to the   server
  -e PATTERN, --pattern=PATTERN   pattern to use when matching. Required if the pattern  looks like a connection specification.
  --database=DATABASE_PATTERN  only look at objects in databases matching this  pattern
  -f FORMAT, --format=FORMAT  display the output in either grid (default), tab, csv,  or vertical format


Related MySQL Articles: mysqlprocgrep utility commands in MySQL

May 23, 2019

MySQL utility - mysqlindexcheck

mysqlindexcheck utility in MySQL

mysqlindexcheck   check for duplicate or redundant indexes

Usage: mysqlindexcheck --server=user:pass@host:port:socket db1.table1 db2 db3.table2


mysqlindexcheck utility, in MySQL, reads the indexes for one or more tables (in specific/all databases) and identifies duplicate and potentially redundant indexes.

mysqlindexcheck --help
mysqlindexcheck --version

mysqlindexcheck --server=root:secret@localhost world
mysqlindexcheck --server=root@localhost --show-drops employees
mysqlindexcheck --server=root@localhost --show-indexes --format=TAB employees

mysqlindexcheck --server=mysql_dba employees --verbose
mysqlindexcheck --server=mysql_dba employees --vvv --skip

mysqlindexcheck Options:
  --version             show program's version number and exit
  --help                display a help message and exit
  --license             display program's license and exit
  --server=SERVER       connection information for the server in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config-path[[group]].

  --ssl-ca=SSL_CA       path to a file that contains a list of trusted SSL CAs.
  --ssl-cert=SSL_CERT   name of the SSL certificate file to use for  establishing a secure connection.
  --ssl-key=SSL_KEY     name of the SSL key file to use for establishing a secure connection.
  --ssl=SSL             specifies if the server connection requires use of  SSL. If an encrypted connection cannot be established, the connection attempt fails. By default 0 (SSL not required).

  -d, --show-drops      display DROP statements for dropping indexes
  -i, --show-indexes    display indexes for each table
  -s, --skip            skip tables that do not exist
  -f FORMAT, --format=FORMAT  display the list of indexes per table in either sql, grid (default), tab, csv, or vertical format

  --stats               show index performance statistics
  --best=BEST           limit index statistics to the best N indexes
  --worst=WORST         limit index statistics to the worst N indexes
  -r, --report-indexes  reports if a table has neither UNIQUE indexes nor a PRIMARY key
  -v, --verbose         control how much information is displayed. e.g., -v = verbose, -vv = more verbose, -vvv = debug


Related MySQL Articles: Cheatsheet of mysqlbinlog utility   mysqlrplshow utility commands in MySQL


April 12, 2019

MySQL mysqldbcopy utility commands

mysqldbcopy commands cheatsheet

mysqldbcopy       copy databases from one server to another  

mysqldbcopy utility, in MySQL, copies a database on a source server to a database on a destination server, with or without GTIDs enabled. Source and destination servers can be same or different.

Usage: mysqldbcopy --source=user:pass@host:port:socket --destination=user:pass@host:port:socket orig_db:new_db

mysqldbcopy --help
mysqldbcopy --version

mysqldbcopy --source=root:pass@localhost --destination=root:pass@localhost world:world_copy
mysqldbcopy --source=root:pass@localhost --destination=root:pass@localhost world:world_copy -vv

mysqldbcopy --source=root:pass@localhost:3310:/test123/mysql.sock --destination=root:pass@localhost:3310:/test123/mysql.sock util_test:util_test_copy
mysqldbcopy --source=source_host --destination=target_host db1:db2 --locking=lock-all

mysqldbcopy --source=source_host --destination=target_host --all --locking=lock-all --quiet
mysqldbcopy --source=root@localhost:3310 --destination=root@localhost:3311 test123 --rpl=master --rpl-user=rpl

mysqldbcopy --source=/path/to/cred.cnf[source] --destination=/path/to/cred.cnf[destination] orig_db:new_db --drop-first
mysqldbcopy --source=/path/to/cred.cnf[source] --destination=/path/to/cred.cnf[destination] orig_db:new_db --drop-first --skip-gtid --verbose




mysql db copy Options:
  --version             show program's version number and exit
  --help                display a help message and exit
  --license             display program's license and exit

  --source=SOURCE       connection information for source server in the form:   user[:password]@host[:port][:socket] or login-path[:port][:socket].
  --destination=DESTINATION connection information for destination server in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket].
  --character-set=CHARSET sets the client character set. The default is retrieved from the server variable 'character_set_client'.
  -d, --drop-first      drop the new database or object if it exists

  -x EXCLUDE, --exclude=EXCLUDE exclude one or more objects from the operation using either a specific name (e.g. db1.t1), a LIKE pattern (e.g. db1.t% or db%.%) or a REGEXP search pattern.
  To use a REGEXP search pattern for all exclusions, you must also specify the --regexp option. Repeat the --exclude option for multiple exclusions.
  -a, --all             include all databases
  --skip=SKIP_OBJECTS   specify objects to skip in the operation in the form of a comma-separated list (no spaces). 
   Valid values = tables, views, triggers, procedures, functions, events, grants, data, create_db
  -v, --verbose         control how much information is displayed. e.g., -v = verbose, -vv = more verbose, -vvv = debug
  -q, --quiet           turn off all messages for quiet execution.

  --new-storage-engine=NEW_ENGINE  change all tables to use this storage engine if storage engine exists on the destination.
  --default-storage-engine=DEF_ENGINE change all tables to use this storage engine if the original storage engine does not exist on the destination.
  --locking=LOCKING     choose the lock type for the operation: no-locks = do not use any table locks, lock-all = use table locks but no transaction and no consistent read, snapshot
                        (default): consistent read using a single transaction.
  -G, --basic-regexp, --regexp use 'REGEXP' operator to match pattern. Default is to use 'LIKE'.

  --rpl-user=RPL_USER   the user and password for the replication user requirement, in the form: user[:password] or  login-path. E.g. rpl:passwd
  --rpl=RPL_MODE, --replication=RPL_MODE include replication information. Choices: 'master' = include the CHANGE MASTER command using the source server as the master, 'slave' = include the CHANGE MASTER command for the source server's master (only works if the source server is a slave).
  --skip-gtid           skip creation and execution of GTID statements during copy.
  --multiprocess=MULTIPROCESS use multiprocessing, number of processes to use for concurrent execution. Special values: 0 (number of processes equal to the CPUs detected) and 1 (default - no concurrency).


Related MySQL Articles:  mysqldump commands   
mysqldiskusage utility


February 14, 2019

MySQL commands - mysqldumpslow utility

MySQL mysqldumpslow utility commands


mysqldumpslow  -- Parse and summarize the MySQL slow query log.

mysqldumpslow [options] [log_file ...]
mysqldumpslow --help
mysqldumpslow --version

mysqldumpslow
mysqldumpslow /var/log/mysql/mysql-slow.log
mysqldumpslow -t 10 /var/lib/mysql/mysql-slow-query.log
mysqldumpslow -a -s c -t 10 /var/lib/mysql/mysql-dump-slow.log
mysqldumpslow -a -s r -t 5 /var/log/mysql/mysql-slow-query.log

mariadb-dumpslow is a symlink to mysqldumpslow

mysql dump slow options:   --verbose    verbose
  --debug        debug
  --help        write this text to standard output

  -v            verbose
  -d            debug
  -s ORDER      what to sort by (al, at, ar, c, l, r, t), 'at' is default
                al: average lock time
                ar: average rows sent
                at: average query time
                  c: count
                  l: lock time
                  r: rows sent
                  t: query time
  -r            reverse the sort order (largest last instead of first)
  -t NUM        just show the top n queries
  -a            don't abstract all numbers to N and strings to 'S'
  -n NUM          abstract numbers with at least n digits within names
  -g PATTERN       grep: only consider stmts that include this string
  -h HOSTNAME    hostname of db server for *-slow.log filename (can be wildcard), default is '*', i.e. match all
  -i NAME      name of server instance (if using mysql.server startup script)
  -l            don't subtract lock time from total time

Related MySQL Articles: mysqldump commands  MySQL mysqlreplicate cheatsheet


February 9, 2019

mysqlserverinfo commands in MySQL

MySQL mysqlserverinfo utility cheatsheet

mysqlserverinfo                show server information                                  

mysqlserverinfo --help
mysqlserverinfo --version

MySQL mysqlserverinfo utility displays common diagnostic information from a MySQL database server. Information like Server connection/version information, Data/Base/Plugin directory path name, file location, position and name

mysqlserverinfo --show-servers --login-path=dba
mysqlserverinfo --show-servers --login-path=sysdba --verbose --no-headers

# mysqlserverinfo --server=root:password@localhost:3310 --format=vertical
# mysqlserverinfo --server=my-linux06 --format=vertical
# mysqlserverinfo --login-path=dba --format=tab -v

mysqlserverinfo --server=root:secret@localhost:3309 --ssl-ca=C:/newcerts/cacert.pem --ssl-cert=C:/newcerts/client-cert.pem --ssl-key=C:/newcerts/client-key.pem --format=vertical

mysqlserverinfo --server=c:\MySQL\my.cnf[instance_3310] --format=vertical
mysqlserverinfo --server=root:secret@localhost -d --format=csv --verbose
mysqlserverinfo --server=root:secret@linux08 --show-defaults --show-servers --format=grid --vvv

mysql server info Options:
  --version              show program's version number and exit
  --help                display a help message and exit
  --license              display program's license and exit
  --server=SERVER        connection information for the server in the form:
  user[:password]@host[:port][:socket] or login-path[:port][:socket] or config-path[[group]].

  --ssl-ca=SSL_CA        path to a file that contains a list of trusted SSL CAs.
  --ssl-cert=SSL_CERT    name of the SSL certificate file to use for establishing a secure connection.
  --ssl-key=SSL_KEY      name of the SSL key file to use for establishing a secure connection.
  --ssl=SSL              specifies if the server connection requires use of SSL. If an encrypted connection cannot be established, the connection attempt fails. By default 0 (SSL not  required).

  -f FORMAT, --format=FORMAT  display the output in either grid (default), tab, csv, or vertical format
  -h, --no-headers      do not show column headers (only applies to formats: grid, tab, csv).
  -d, --show-defaults    show defaults from the config file per server
  -s, --start            start server in read only mode if offline

  --basedir=BASEDIR      the base directory for the server
  --datadir=DATADIR      the data directory for the server
  --port-range=PORTS    the port range to search for running mysql servers on Windows systems
  --show-servers        show any known MySQL servers running on this host
  --start-timeout=START_TIMEOUT Number of seconds to wait for the server to start. Default = 10.
  -v, --verbose          control how much information is displayed. e.g., -v = verbose, -vv = more verbose, -vvv = debug


Related MySQL Articles: mysqlrplshow utility commands in MySQL  mysqldbcompare utility

January 1, 2019

MySQL mysqlreplicate cheatsheet

mysqlreplicate utility commands in MySQL

mysqlreplicate    Establish replication with a master

MySQL Database Administrators (DBAs) use mysqlreplicate utility to setup/start replication from MySQL master to slave.

Usage: mysqlreplicate --master=root@localhost:3306 --slave=root@localhost:3310 --rpl-user=rpl:passwd

mysqlreplicate --help
mysqlreplicate --version

mysqlreplicate --master=host1 --slave=host2 --rpl-user=rpluser
mysqlreplicate --master=root:password@server1 --slave=root: password@server2 --rpl-user=replication_user:password

mysqlreplicate --master=master1 --slave=linux1 --rpl-user=sysdba --pedantic
mysqlreplicate --master=linux1 --slave=slave1 --rpl-user=root -v --pedantic

mysqlreplicate --master=master1 --slave=slave1 --rpl-user=dba --pedantic --quiet
mysqlreplicate --master=replication@server1:3306 --slave=replication@server4:3306 --rpl-user=root -vv --pedantic

mysqlreplicate --master=root:password@server1:3310 --slave=root: password@server2:3310 --rpl-user=replication_user:password --verbose -p
mysqlreplicate --master=root@localhost:3306 --slave=root@localhost:3307 --rpl-user=rpl:rpl --master-log-file=mysql_log.000006 --master-log-pos=333


mysqlreplicate --master=linux1 --slave=slave1 --rpl-user=root -v --start-from-beginning

mysql replicate options:
  --version            show program's version number and exit
  --help                display a help message and exit
  --license              display program's license and exit
  --master=MASTER       connection information for master server in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config- path[[group]].
  --slave=SLAVE          connection information for slave server in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config- path[[group]].
  --rpl-user=RPL_USER   the user and password for the replication user requirement, in the form: user[:password] or login-path. e.g. rpl:passwd

  -p, --pedantic        fail if storage engines differ among master and slave.
  --test-db=TEST_DB      database name to use in testing replication setup (optional).
  --master-log-file=MASTER_LOG_FILE use this master log file to initiate the slave.
  --master-log-pos=MASTER_LOG_POS use this position in the master log file to initiate the slave.
  -b, --start-from-beginning start replication from the first event recorded in the binary logging of the master. Not valid with --master- log-file or --master-log-pos.

  --ssl-ca=SSL_CA        path to a file that contains a list of trusted SSL CAs.
  --ssl-cert=SSL_CERT    name of the SSL certificate file to use for  establishing a secure connection.
  --ssl-key=SSL_KEY      name of the SSL key file to use for establishing a secure connection.
  --ssl=SSL              specifies if the server connection requires use of SSL. If an encrypted connection cannot be established, the connection attempt fails. By default 0 (SSL not required).

  -v, --verbose          control how much information is displayed. e.g., -v =verbose, -vv = more verbose, -vvv = debug.
  -q, --quiet            turn off all messages for quiet execution.

Related MySQL Articles: MySQL mysqlfailover utility commands