How to remotely manage mysql through mysqladmin

Source: Internet
Author: User
Tags x509 cert

On the server where mysql is installed locally, open cmd and cd to the bin directory under the mysql installation directory. Multiple executable files can be seen in the bin directory, mysqladmin can be used to remotely close 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 program for the mysqld daemon.
Usage: mysqladmin [OPTIONS] command ....
-C,-count = # Number of iterations to make. This works with-I
(-Sleep) only.
-Debug-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;
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 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 current and previous values when
Used with-I. Currently works only with extended-status.
-O,-set-variable = name
Change the value of a variable. Please note that this
Option is deprecated; you can set variables directly
-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.
-Ssl Enable SSL for connection (automatically enabled
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
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,
Prints output vertically.
-W,-wait [= #] Wait and retry if connection is 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-cert (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 may be given as the first argument:
-Print-defaults Print the program argument list and exit
-No-defaults Don't read default options from any options file
-Defaults-file = # Only read default options from the given file #
-Defaults-extra-file = # Read this file after the global files are read

Where command is a one or more of: (Commands may be shortened)
Create databasename Create a new database
Debug Instruct server to write debug information to log
Drop databasename Delete a database and all its tables
Extended-status Gives an extended status message from 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 and 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 to specify the remote login user,-p to specify the final command part requiring password authentication, and use shutdown.
The complete command is as follows:
Mysqladmin-h10.101.0.1-uroot-p123456 shutdown

Likewise, you can remotely run ping processlist reload refresh shutdown status start-slave stop-slave variables version and other commands.

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.