通过mysqladmin远程管理mysql的方法_Mysql

在本地安装mysql的服务端,打开cmd,cd到mysql安装目录下的bin目录,bin目录中可以看到多个可执行文件,其中mysqladmin就是可以用于远程关闭mysql服务的。

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

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

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

这里我们只需要其中的-h 参数指定远端主机,-u指定远端登录用户,-p指定需要使用密码认证 最后的命令部分,使用shutdown即可
完整命令如下:
mysqladmin -h10.101.0.1 -uroot -p123456 shutdown

当然同理,可以远程执行ping processlist reload refresh shutdown status start-slave stop-slave variables version等命令

时间: 2024-09-03 04:57:43

通过mysqladmin远程管理mysql的方法_Mysql的相关文章

详细讲解安全升级MySQL的方法_Mysql

MySQL升级是非常必要的. 我们在Percona Support上列出了关于MySQL升级最佳实践的各种问题.这篇文章推荐了一些不同情况下升级MySQL的方法. 为什么MySQL升级是必须的? 原因有很多,比如:为了使用新增的特性,基于性能方面的考量, 修复的bug. 但是在没有充分的测试以前就应用到你的应用中是非常危险的, 因为升级可以能会让你的应用不能正常运作- 也可能引起性能的问题. 此外, 我建议你关注MySQL的发布信息和Percona Server - 看看最近的版本有什么变化.

Win8系统启动添加telnet远程管理工具的方法

对于我们电脑中的telnet组件,是我们windows系统自带的一个远程管理工具,因为这一组件存在一定的安全隐私隐患,在windows系统中现在默认不携带,所以不启动telnet组件服务,如果个人喜欢这一功能,我们也可以设置执行开启.那么对这样的操作,我们要如何才能开启Win8系统的telnet组件服务呢?   1.右击Win8系统桌面左下角windwos按钮选择控制面板:     2.在打开的控制面板界面如图所示切换到小图标模式,找到[程序和工能]选项:     3.在"程序和功能"

远程连接mysql 授权方法详解_Mysql

今在服务器上 有mysql 数据库,远程访问,不想公布root账户,所以,创建了demo账户,允许demo账户在任何地方都能访问mysql数据库中shandong库. 方案一: 在安装mysql的机器上运行: 1: 创建user用户 复制代码 代码如下: CREATE USER demo IDENTIFIED BY "123456" 2. 复制代码 代码如下: mysql>GRANT ALL PRIVILEGES ON shandong.* TO 'demo'@'%'WITH G

windows和linux安装mysql后启用日志管理功能的方法_Mysql

查看是否启用了日志 复制代码 代码如下: mysql>show variables like 'log_bin'; 怎样知道当前的日志 复制代码 代码如下: mysql> show master status; 展示二进制日志数目 复制代码 代码如下: mysql> show master logs; 看二进制日志文件用mysqlbinlog 复制代码 代码如下: shell>mysqlbinlog mail-bin.000001 或者 复制代码 代码如下: shell>my

巧用mysql提示符prompt清晰管理数据库的方法_Mysql

mysql>prompt \u@\h(\d) \r:\m:\s> \u:连接用户 \h:连接主机 \d:连接数据库 \r:\m:\s:显示当前时间 mysql>prompt \u@\h(\d) \r:\m:\s> root@localhost(mysql) 08:55:21> status -------------- mysql Ver 14.14 Distrib 5.1.33, for Win32 (ia32) Connection id: 2 Current datab

windows下重启mysql的方法_Mysql

其中第二种方法对我这无效,以后再搞清楚! 一.MYSQL服务 我的电脑--(右键)管理--服务与应用程序--服务--MYSQL--开启(停止.重启动) 二.命令行方式 Windows 1.点击"开始"->"运行"(快捷键Win+R). 2.启动:输入 net stop mysql 3.停止:输入 net start mysql 提示* Redhat Linux 也支持service command,启动:# service mysqld start 停止:#

asp采用ODBC接口访问MySQL的方法_Mysql

MySQL的ODBC接口实现是通过安装MyODBC驱动,这个驱动程序是跨平台的.如果在Linux等unix体系操作系统下使用,需要先安装iodbc这些第三方ODBC标准支援平台.  简单的ASP示例代码:  <%  dim sql,mysql  set sql = server.createobject("adodb.connection")  mysql="driver={mysql odbc 3.51 driver};database=库;server=主机;uid

简单实现SQLServer转MYSQL的方法_Mysql

本次转换需要依赖使用工具Navicat Premium. 首先,将数据库移至本地SQLServer,我试过直接在局域网上其他SQLServer服务器上想转到本地Mysql好像有问题,想将远程数据库备份恢复到本地. 1.打开Navicat Premium,新建一个同名的数据库,然后在表上点击"导入向导".并选择"ODBC". 2.选择SQLServer提供程序,并输入参数. 3.然后就拼命下一步.下一步. 在这里有个条件查询,如果有太多不想要的数据,或者字段类型有问题

在VB.NET应用中使用MySQL的方法_Mysql

 绪言 在Visual Studio中使用向导连接到MySQL数据库是一件相当棘手的事情.因为MySQL并不在VS2012默认支持的数据库中(比如SQL Server).在本文中我将介绍如何使用VB.NET连接到MySQL数据库并且执行SQL语句(SELECT,UPDATE,DELETE),同时我会展示如何将MySQL连接器导入(connectors)到Visual Studio 2012中. 使用代码     你须要从http://dev.mysql.com/downloads/connect