데이터 베이스 MySQL 튜토리얼 MYSQL入门学习之十八:MYSQLADMIN命令参数详解_MySQL

MYSQL入门学习之十八:MYSQLADMIN命令参数详解_MySQL

Jun 01, 2016 pm 01:37 PM
database 표현

bitsCN.com

MYSQL入门学习之十八:MYSQLADMIN命令参数详解

 

相关链接:

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

http:///database/201212/173868.html

MYSQL入门学习之二:使用正则表达式搜索

http:///database/201212/173869.html

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

http:///database/201212/173873.html

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

http:///database/201212/175536.html

MYSQL入门学习之五:MYSQL的字符集

http:///database/201212/175541.html

MYSQL入门学习之六:MYSQL的运算符

http:///database/201212/175862.html

MYSQL入门学习之七:MYSQL常用函数

http:///database/201212/175864.html

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

http:///database/201212/175867.html

MYSQL入门学习之九:索引的简单操作

http:///database/201212/176772.html

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

http:///database/201212/176775.html

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

http:///database/201212/176781.html

MYSQL入门学习之十二:存储过程的基本操作

http:///database/201212/177380.html

MYSQL入门学习之十三:自定义函数的基本操作

http:///database/201212/177382.html

MYSQL入门学习之十四:游标的基本操作

http:///database/201212/177384.html

MYSQL入门学习之十五:事务处理的基本操作

http:///database/201212/177385.html

MYSQL入门学习之十六:MYSQL命令参数详解

http:///database/201212/178079.html

 

mysqladmin工具主要用来对数据库做一些简单的操作,以及显示服务器状态等。其使用格式如下:    

        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.  

  -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             (No default value)  

host                              (No default value)  

no-beep                           FALSE  

port                              0  

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 D:/APMServ5.2.6/MySQL5.1/my.ini D:/APMServ5.2.6/MySQL5.1/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  

        帮助信息主要包括三部分:

        第一部分为mysqladmin命令的相关选项,详细说明如下:

 

-c, --count=# Number of iterations to make. This works with -i (--sleep) only. 自动运行次数,必须和 -i 一起使用

--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. 禁用错误,drop 数据库时不提示,执行多条命令时出错继续执行

-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. 显示前后变化的值,必须结合- i

-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. 修改变量的值,使用--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. 指定socket file

-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. 显示MYSQLADMIN的版本

-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=# 超时关闭         示例:

[sql] 

C:/Users/qxl>mysqladmin -uroot -E -i 3 -c 2 status  

Uptime: 1590  Threads: 1  Questions: 5  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second  

avg: 0.3  

Uptime: 1593  Threads: 1  Questions: 5  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second  

avg: 0.3  

  

C:/Users/qxl>mysqladmin -V  

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

       第二部分为mysqladmin的相关变量。

        第三部分为mysqladmin可以执行的相关服务器命令,详细说明如下:

 

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) 再次装载授权表(同reload)

kill id,id,... Kill mysql threads 杀死mysql线程

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 检查mysqld是否在线

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 启动slave

stop-slave Stop slave 关闭slave

variables Prints variables available 打印出可用变量

version Get version info from server 得到服务器的版本信息

        示例:

 

[sql] 

C:/Users/qxl>mysqladmin -uroot version  

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  

  

Server version          5.1.28-rc-community  

Protocol version        10  

Connection              localhost via TCP/IP  

TCP port                3306  

Uptime:                 31 min 3 sec  

  

Threads: 1  Questions: 23  Slow queries: 0  Opens: 16  Flush tables: 2  Open tables: 0  Queries per second avg: 0.12  

  

C:/Users/qxl>mysqladmin -u root -p create test_admin  

Enter password:  

  

C:/Users/qxl>mysqladmin -u root -p drop test_admin  

Enter password:  

Dropping the database is potentially a very bad thing to do.  

Any data stored in the database will be destroyed.  

  

Do you really want to drop the 'test_admin' database [y/N] y  

Database "test_admin" dropped  

  

C:/Users/qxl>mysqladmin -u root flush-status  

  

C:/Users/qxl>mysqladmin -u root processlist  

+----+------+----------------+----+---------+------+-------+------------------+  

| Id | User | Host           | db | Command | Time | State | Info             |  

+----+------+----------------+----+---------+------+-------+------------------+  

| 21 | root | localhost:8925 |    | Query   | 0    |       | show processlist |  

+----+------+----------------+----+---------+------+-------+------------------+  

  

C:/Users/qxl>mysqladmin -u root status  

Uptime: 1947  Threads: 1  Questions: 32  Slow queries: 0  Opens: 18  Flush tables: 2  Open tables: 2  Queries per second  

 avg: 0.16  

        其中mysqladmin -u root status输出信息中各项的详细说明如下:

        Uptime:MySQL服务器已经运行的秒数

        Threads:活跃线程(客户)的数量

        Questions:从mysqld启动起来自客户查询的数量

        Slow queries:已经超过long_query_time秒的查询数量

        Opens:mysqld已经打开了多少表

        Flush tables:flush ..., refresh和reload命令数量

        Open tables:现在被打开的表数量

        Queries per second avg:查询平均用时
 

bitsCN.com
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

discuz 데이터베이스 오류를 해결하는 방법 discuz 데이터베이스 오류를 해결하는 방법 Nov 20, 2023 am 10:10 AM

discuz 데이터베이스 오류에 대한 해결 방법은 다음과 같습니다. 1. 데이터베이스 구성을 확인합니다. 2. 데이터베이스 서버가 실행 중인지 확인합니다. 4. 데이터를 백업합니다. 6. Discuz를 다시 설치합니다. 7. 서버 리소스를 확인하세요. 8. Discuz 공식 지원팀에 문의하세요. Discuz 데이터베이스 오류를 해결하려면 여러 측면에서 시작하여 점차적으로 문제의 원인을 식별하고 이에 상응하는 조치를 취하여 복구해야 합니다.

누출로 Intel Arrow Lake-U, -H, -HX 및 -S의 주요 사양 공개 누출로 Intel Arrow Lake-U, -H, -HX 및 -S의 주요 사양 공개 Jun 15, 2024 pm 09:49 PM

Intel Arrow Lake는 Lunar Lake와 동일한 프로세서 아키텍처를 기반으로 할 것으로 예상됩니다. 즉, Intel의 새로운 LionCove 성능 코어가 경제적인 Skymont 효율성 코어와 결합될 것입니다. Lunar Lake는 Ava에서만 사용할 수 있습니다.

데이터베이스를 삭제할 수 없습니다. 데이터베이스가 존재하지 않습니다. - MySQL 오류 해결 방법: 데이터베이스를 삭제할 수 없습니다. 데이터베이스가 존재하지 않습니다. 데이터베이스를 삭제할 수 없습니다. 데이터베이스가 존재하지 않습니다. - MySQL 오류 해결 방법: 데이터베이스를 삭제할 수 없습니다. 데이터베이스가 존재하지 않습니다. Oct 05, 2023 am 11:46 AM

MySQL 오류 해결 방법: 데이터베이스를 삭제할 수 없습니다. 데이터베이스가 존재하지 않습니다. 개요: MySQL은 일반적으로 사용되는 관계형 데이터베이스 관리 시스템입니다. MySQL을 사용할 때 데이터베이스 생성, 데이터베이스 삭제 및 기타 작업을 포함하여 데이터베이스를 관리해야 하는 경우가 많습니다. 그러나 데이터베이스를 삭제할 때 "Can'tdropdatabase'database_name';databasedoesn'texist"라는 오류 메시지가 나타나는 경우가 있습니다. 즉, 데이터베이스를 삭제할 수 없습니다.

Python 표현식 구문 오류를 해결하는 방법은 무엇입니까? Python 표현식 구문 오류를 해결하는 방법은 무엇입니까? Jun 24, 2023 pm 05:04 PM

고급 프로그래밍 언어인 Python은 배우고 사용하기 쉽습니다. Python 프로그램을 작성해야 하면 필연적으로 구문 오류가 발생하며 표현식 구문 오류는 흔한 오류입니다. 이 기사에서는 Python에서 표현식 구문 오류를 해결하는 방법에 대해 설명합니다. 표현식 구문 오류는 Python에서 가장 일반적인 오류 중 하나이며 일반적으로 구문을 잘못 사용하거나 필요한 구성 요소가 누락되어 발생합니다. Python에서 표현식은 일반적으로 숫자, 문자열, 변수 및 연산자로 구성됩니다. 가장 흔한

C 및 C++에서 쉼표는 표현식이나 명령문을 구분하는 데 사용됩니다. C 및 C++에서 쉼표는 표현식이나 명령문을 구분하는 데 사용됩니다. Sep 09, 2023 pm 05:33 PM

C 또는 C++에서 쉼표 ","는 다른 용도로 사용됩니다. 여기서 우리는 그것들을 사용하는 방법을 배울 것입니다. 연산자로서의 쉼표. 쉼표 연산자는 첫 번째 피연산자를 평가하고 결과를 버린 다음 두 번째 피연산자를 평가하고 값을 반환하는 이항 연산자입니다. 쉼표 연산자는 C 또는 C++에서 우선순위가 가장 낮습니다. 예 #include<stdio.h>intmain(){ intx=(50,60); inty=(func1(),func2());} 여기서 60은 x에 할당됩니다. 다음 명령문에서는 func1(이 먼저 실행됩니다.

C 언어의 지수 함수 표현 소개 C 언어의 지수 함수 표현 소개 Feb 18, 2024 pm 01:11 PM

C 언어의 지수 함수 표현 작성 방법 소개 및 코드 예제 지수 함수란 수학에서 흔히 사용되는 함수 유형으로 f(x)=a^x 형식으로 표현됩니다. a는 밑수이고 x는 지수입니다. 지수 함수는 주로 지수 증가 또는 지수 붕괴를 설명하는 데 사용됩니다. 지수 함수의 코드 예 C 언어에서는 수학 라이브러리의 pow() 함수를 사용하여 지수 함수를 계산할 수 있습니다. 다음은 샘플 프로그램입니다.

Java의 람다 표현식 Java의 람다 표현식 Jun 09, 2023 am 10:17 AM

Java의 람다 표현식 Java 8이 출시되면서 람다 표현식은 Java 개발자들 사이에서 가장 관심을 갖고 논의되는 주제 중 하나가 되었습니다. 람다 표현식은 Java 프로그래머의 지루한 작성 방법을 단순화하고 프로그램의 가독성과 유지 관리성을 향상시킬 수도 있습니다. 이 기사에서는 Java의 람다 표현식과 이 표현식이 Java 코드에서 더 간단하고 직관적인 프로그래밍 경험을 제공하는 방법에 대해 자세히 살펴보겠습니다.

람다 표현식을 사용하여 컬렉션 반복 람다 표현식을 사용하여 컬렉션 반복 Feb 19, 2024 pm 07:32 PM

람다 식은 컬렉션을 반복하는 데 편리하게 사용할 수 있는 익명 함수입니다. 이 문서에서는 람다 식을 사용하여 컬렉션을 반복하는 방법을 소개하고 구체적인 코드 예제를 제공합니다. Python에서 람다 표현식의 구문 형식은 다음과 같습니다. 람다 매개변수 목록: 표현식 람다 표현식의 매개변수 목록에는 쉼표로 구분된 하나 이상의 매개변수가 포함될 수 있습니다. 표현식은 람다 함수의 반환 값입니다. 아래의 간단한 예를 살펴보겠습니다.

See all articles