金沙国际唯一官网网址MYSQL入门上学之10八:MYSQLADMIN命令参数详解

the replication thread will not be killed except for using,It’s a,MYSQL入门学习之三,全文本搜索,mysqladmin -h10.101.0.1 -uroot -p123456 shutdown,cd到mysql安装目录下的bin目录,mysqladmin -h10.101.0.1 -uroot -p123456 shutdown,cd到mysql安装目录下的bin目录

 

MYSQL入门上学之⑩捌:MYSQLADMIN命令参数详解

在地点安装mysql的服务端,展开cmd,cd到mysql安装目录下的bin目录,bin目录中能够见见多少个可实践文件,在那之中mysqladmin就是足以用来远程关闭mysql服务的。

在地点安装mysql的服务端,张开cmd,cd到mysql安装目录下的bin目录,bin目录中能够见见八个可实施文件,在那之中mysqladmin正是足以用来远程关闭mysql服务的。

Preface

 

mysqladmin的参数如下:

mysqladmin的参数如下:

 

有关链接:

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

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

    Sometimes,we are determined to kill
some MySQL connections which are occupying huge
resources(CPU,memory,etc) that maybe lead to server crash.Even though
it’s simple to use “kill id;”(id is a number of MySQL thread which we
can get from “show processlist;”) command of MySQL doing that kind of
job.But it’s not enough in function.

MYSQL入门上学之一:基本操作

Administration program 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 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 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 is down.
–connect_timeout=#
–shutdown_timeout=#

Administration program 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 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 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 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

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

Introduce

MYSQL入门上学之二:使用正则表明式寻找

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

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.

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.

*    pt-kill is a commonly used tool in
killing MySQL connections.It provides more individual functions by set
different options than MySQL kill command.You can also use it to print
the candidates to be killed instead of really killing them.Let’s see
some details of the tool below.

*

MYSQL入门上学之三:全文本搜索

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

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

 

此间大家只必要中间的-h
参数钦定远端主机,-u钦点远端登6用户,-p内定需求选用密码验证
最终的一声令下部分,使用shutdown就能够
总体命令如下:
mysqladmin -h10.101.0.1 -uroot -p123456 shutdown

那边大家只必要中间的-h
参数钦点远端主机,-u钦赐远端登入用户,-p钦定供给动用密码验证
最后的下令部分,使用shutdown就可以
完全命令如下:
mysqladmin -h10.101.0.1 -uroot -p123456 shutdown

Procedure

MYSQL入门上学之四:MYSQL的数据类型

自然同理,能够远程实行ping processlist reload refresh shutdown status
start-slave stop-slave variables version等一声令下

当然同理,能够远程执行ping processlist reload refresh shutdown status
start-slave stop-slave variables version等一声令下

 

您只怕感兴趣的小说:

  • Linux中利用mysqladmin
    extended-status同盟Linux命令查看MySQL运转状态
  • mysql
    DBA:mysqladmin常用命令总计
  • 动用mysqladmin检测MySQL运市价况的教程

Usage

MYSQL入门上学之5:MYSQL的字符集

1 pt-kill [OPTIONS] [DSN]

 

MYSQL入门上学之陆:MYSQL的运算符

**Common parameters**

 1 --busy-time -- Match queries that running longer than this time which match the "Command=Query" status.
 2 --idle-time -- Match querries that idle/sleeping longer than this time which match the "Command=Sleep" status.
 3 --victims -- Specify the scope which can be killed(default "oldest",others "all","all-but-oldest").
 4 --match-user -- Specify a user which you want to match.
 5 --match-host -- Specify a host which you want to match.
 6 --match-db -- Specify a db which you want to match.
 7 --match-command -- Specify a command type which you want to match.
 8 --match-state -- Specify a state type which you want to match.
 9 --match-info -- Specify a query which you want to match.
10 --test-matching -- Only used to match queries in file which contains the snapshot of processlist.(disable --run-time,--interval and --[no]ignore_self)
11 --run-time -- Specify the max running time(default unit is second).
12 --interval -- Specify the frequency for queries(default 30s if not set --interval).
13 --kill -- Execute a real kill command for those matched queries to kill both connections and queries.
14 --kill-query -- Do like what --kill does but merely queries,it does not kill connections.
15 --kill-busy-command -- It is usually used to kill the execute statement instead of query statement(eg.--kil-busy-command=execute).
16 --print -- Just print a kill statement instead of really execute them for matched queries.
17 --query-count -- Match query class if it has reached this value.

MYSQL入门上学之7:MYSQL常用函数

 


MYSQL入门上学之八:数据库及表的基本操作

Demonstrate of mutually exclusive options.***

Specify at least one of --kill, --kill-query, --print, --execute-command or --stop.
--any-busy-time & --each-busy-time.--kill & --kill-query.
--daemonize & --test-matching.

MYSQL入门上学之九:索引的简约操作

 

**1. Print all kill statement of query
threads which have been run over 10s.**

MYSQL入门上学之十:视图的基本操作

1 pt-kill -h192.168.56.100 -P3306 -urepl --ask-pass --victims=all --busy-time=10 --print

 

MYSQL入门上学之十一:触发器的基本操作

**2. Kill all the query
threads which have been run over 10s.**

1 pt-kill -h192.168.56.100 -P3306 -urepl --ask-pass --victims=all --busy-time=10 --kill

MYSQL入门上学之10二:存款和储蓄进度的基本操作

 

3. Kill all the query threads
which 
have been run over 10s in every 60s.

MYSQL入门上学之10叁:自定义函数的基本操作

1 pt-kill -h192.168.56.100 -P3306 -urepl --ask-pass --victims=all --busy-time=10 --interval=60 --kill

 

MYSQL入门上学之10四:游标的基本操作

4. Kill all the execute threads
which 
have been run over 10s.

1 pt-kill -h192.168.56.100 -P3306 -urepl --ask-pass --victims=all --busy-time=10 --match-command=execute --kill

MYSQL入门上学之105:事务管理的基本操作

 

**5. Print all the query threads
which have been run over 10s in processlist.**

MYSQL入门上学之十6:MYSQL命令参数详解

1 mysql -e "show processlist;" > proclist.log
2 pt-kill --test-matching=proclist.log --busy-time=10 --print

 

 

Summary

mysqladmin工具根本用来对数据库做一些简短的操作,以及显示服务器状态等。其采纳格式如下:
 www.二cto.com  

  • pt-kill
    is a quite useful tool to fast and simply kill threads of
    MySQL.
  • It’s a
    good behaviour using “–print” before you really execute killing
    operation.
  • By
    default,the replication thread will not be killed except for using
    “–replication-threads” option.
  • Notice,don’t
    be confused with “–run-time” & “–busy-time”,they’re totally
    different.

        mysqladmin [option] command [command option] command ……

 

        在命令行中输入mysqladmin -?,打字与印刷出如下帮助消息

[sql] 

C:\Users\qxl>mysqladmin –help  

mysqladmin  Ver 8.42 Distrib 5.1.28-rc, for Win32 on ia32  

Copyright (C) 2000-2006 MySQL AB  

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 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 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.