How to remotely manage Mysql via mysqladmin _mysql

Source: Internet
Author: User
Tags flush openssl x509 cert

In the local installation of MySQL server, open cmd,cd to the MySQL installation directory in the bin directory, the bin directory can see multiple executables, where mysqladmin can be used to remotely shut down the MySQL service.

The mysqladmin parameters are as follows:

Mysqladmin Ver 8.42 distrib 5.5.2-m2, for Win32 on IA32
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with absolutely NO WARRANTY. This is free software,
And you are welcome to modify and redistribute it under the GPL license

Administration for the mysqld daemon.
usage:mysqladmin [OPTIONS] Command command ....
-c,–count=# number of iterations to make. This works With-i
(–sleep) only.
–debug-check check memory and open file usage at exit.
–debug-info Print some debug info at exit.
-f,–force Don ' t ask for confirmation on drop database; With
Multiple commands, continue even if an error occurs.
-c,–compress use compression in Server/client protocol.
–character-sets-dir=name
Directory where character sets are.
–default-character-set=name
Set the default character set.
-?, –help Display this Help and exit.
-h,–host=name Connect to host.
-b,–no-beep Turn off beep on error.
-p,–password[=name]
Password to use when connecting to server. If Password is
Not given it's asked from the TTY.
-w,–pipe use Named pipes to connect to the to server.
-p,–port=# port number to use for connection or 0 for default to, in
Order of preference, MY.CNF, $MYSQL _tcp_port,
/etc/services, built-in default (3306).
–protocol=name the Protocol of Connection (Tcp,socket,pipe,memory).
-r,–relative Show difference between and previous values when
Used With-i. Currently works only with Extended-status.
-o,–set-variable=name
Change the value of a variable. Please
option is deprecated; Can set variables directly with
–variable-name=value.
–shared-memory-base-name=name
Base name of shared memory.
-s,–silent silently exit if one can ' t connect to server.
-s,–socket=name socket file to use for connection.
-i,–sleep=# Execute commands again and again with a sleep between.
–SSL Enable SSL for connection (automatically enabled with
Other flags). Disable With–skip-ssl.
–ssl-ca=name CA file in PEM format (check OpenSSL docs, implies
–SSL).
–ssl-capath=name CA directory (check OpenSSL docs, Implies–ssl).
–ssl-cert=name X509 cert in PEM format (IMPLIES–SSL).
–ssl-cipher=name SSL cipher to use (IMPLIES–SSL).
–ssl-key=name X509 key in PEM format (IMPLIES–SSL).
–ssl-verify-server-cert
Verify server ' s "Common Name" in its cert against
hostname used when connecting. This option is disabled by
Default.
-u,–user=name user for Login if not current user.
-v,–verbose Write more information.
-v,–version Output version information and exit.
-e,–vertical Print output vertically. is similar to–relative, but
Prints output vertically.
-w,–wait[=#] Wait and retry if connection are down.
–connect_timeout=#
–shutdown_timeout=#

Variables (–variable-name=value)
and Boolean options {false| TRUE} Value (after reading options)
——————————— ————————— –
Count 0
Debug-check FALSE
Debug-info false
Force false
Compress false
Character-sets-dir (no default value)
Default-character-set Auto
Host (no Default value)
No-beep false
Port 3306
Relative false
Shared-memory-base-name (no default value)
Socket (no default value)
Sleep 0
SSL FALSE
Ssl-ca (no default value)
Ssl-capath (no default value)
Ssl-ce RT (no default value)
Ssl-cipher (no default value)
Ssl-key (no default value)
Ssl-verify-server-cert FALSE
User (No default value)
Verbose false
Vertical false
Connect_timeout 43200
Shutdown_timeout 3600

Default options are read from the following files in the given order:
C:\WINDOWS\my.ini C:\WINDOWS\my.cnf C:\my.ini C:\MY.CNF F:\MySQL\my.ini F:\MYSQL\MY.CNF
The following groups are Read:mysqladmin client
the following options Ma Y be given as the "the" argument:
–print-defaults Print the program argument list and exit
–no-defaults Don T read D Efault options from any options file
–defaults-file=# only read default options from the given file #
–defaults-extr a-file=# read this file after the global files are Read

Where command is a one or more: (Commands May to shortened)
Create databasename Create a new database
debug in struct server to write debug information to log
drop databasename Delete a database and all its tables
Extended-stat US gives an extended status message to the server
Flush-hosts flush all cached hosts
Flush-logs flush all logs
Flush-status Clear Status Variables
flush-tables flush All tables
Flush-threads flush the thread cache
Flush-privileges Reload Grant tables (same as Reload)
Kill Id,id,... Kill MySQL threads
Password new-password change old password to New-password, MySQL 4.1 hashing.
Old-password new-password change old password to New-password in old format.

Ping Check if mysqld is alive
Processlist Show list of active threads in server
Reload Reload Grant Tables
Refresh Flush All tables with close and open logfiles
Shutdown Take Server down
Status gives a short status message from the server
Start-slave Start Slave
Stop-slave Stop Slave
Variables Prints variables available
Version get version info from server


Here we only need the-h parameter to specify the remote host,-u specifies the remote login user,-p specifies that the last command part of the password authentication needs to be used, and the shutdown can be used
The complete command is as follows:
mysqladmin-h10.101.0.1-uroot-p123456 shutdown

Of course, the same can be done remotely ping processlist reload refresh shutdown status Start-slave stop-slave version commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.