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:查询平均用时

innodbbufferpool은 데이터와 인덱싱 페이지를 캐싱하여 디스크 I/O를 줄여 데이터베이스 성능을 향상시킵니다. 작업 원칙에는 다음이 포함됩니다. 1. 데이터 읽기 : BufferPool의 데이터 읽기; 2. 데이터 작성 : 데이터 수정 후 BufferPool에 쓰고 정기적으로 디스크로 새로 고치십시오. 3. 캐시 관리 : LRU 알고리즘을 사용하여 캐시 페이지를 관리합니다. 4. 읽기 메커니즘 : 인접한 데이터 페이지를 미리로드합니다. Bufferpool을 크기를 조정하고 여러 인스턴스를 사용하여 데이터베이스 성능을 최적화 할 수 있습니다.

다른 프로그래밍 언어와 비교할 때 MySQL은 주로 데이터를 저장하고 관리하는 데 사용되는 반면 Python, Java 및 C와 같은 다른 언어는 논리적 처리 및 응용 프로그램 개발에 사용됩니다. MySQL은 데이터 관리 요구에 적합한 고성능, 확장 성 및 크로스 플랫폼 지원으로 유명하며 다른 언어는 데이터 분석, 엔터프라이즈 애플리케이션 및 시스템 프로그래밍과 같은 해당 분야에서 이점이 있습니다.

MySQL은 데이터 저장, 관리 및 분석에 적합한 강력한 오픈 소스 데이터베이스 관리 시스템이기 때문에 학습 할 가치가 있습니다. 1) MySQL은 SQL을 사용하여 데이터를 작동하고 구조화 된 데이터 관리에 적합한 관계형 데이터베이스입니다. 2) SQL 언어는 MySQL과 상호 작용하는 열쇠이며 CRUD 작업을 지원합니다. 3) MySQL의 작동 원리에는 클라이언트/서버 아키텍처, 스토리지 엔진 및 쿼리 최적화가 포함됩니다. 4) 기본 사용에는 데이터베이스 및 테이블 작성이 포함되며 고급 사용량은 Join을 사용하여 테이블을 결합하는 것과 관련이 있습니다. 5) 일반적인 오류에는 구문 오류 및 권한 문제가 포함되며 디버깅 기술에는 구문 확인 및 설명 명령 사용이 포함됩니다. 6) 성능 최적화에는 인덱스 사용, SQL 문의 최적화 및 데이터베이스의 정기 유지 보수가 포함됩니다.

MySQL은 초보자가 데이터베이스 기술을 배우는 데 적합합니다. 1. MySQL 서버 및 클라이언트 도구를 설치하십시오. 2. SELECT와 같은 기본 SQL 쿼리를 이해하십시오. 3. 마스터 데이터 작업 : 데이터를 만들고, 삽입, 업데이트 및 삭제합니다. 4. 고급 기술 배우기 : 하위 쿼리 및 창 함수. 5. 디버깅 및 최적화 : 구문 확인, 인덱스 사용, 선택*을 피하고 제한을 사용하십시오.

MySQL은 테이블 구조 및 SQL 쿼리를 통해 구조화 된 데이터를 효율적으로 관리하고 외래 키를 통해 테이블 간 관계를 구현합니다. 1. 테이블을 만들 때 데이터 형식을 정의하고 입력하십시오. 2. 외래 키를 사용하여 테이블 간의 관계를 설정하십시오. 3. 인덱싱 및 쿼리 최적화를 통해 성능을 향상시킵니다. 4. 데이터 보안 및 성능 최적화를 보장하기 위해 데이터베이스를 정기적으로 백업 및 모니터링합니다.

MySQL은 웹 개발에 널리 사용되는 오픈 소스 관계형 데이터베이스 관리 시스템입니다. 주요 기능에는 다음이 포함됩니다. 1. 다른 시나리오에 적합한 InnoDB 및 MyISAM과 같은 여러 스토리지 엔진을 지원합니다. 2.로드 밸런싱 및 데이터 백업을 용이하게하기 위해 마스터 슬레이브 복제 기능을 제공합니다. 3. 쿼리 최적화 및 색인 사용을 통해 쿼리 효율성을 향상시킵니다.

SQL은 MySQL 데이터베이스와 상호 작용하여 데이터 첨가, 삭제, 수정, 검사 및 데이터베이스 설계를 실현하는 데 사용됩니다. 1) SQL은 Select, Insert, Update, Delete 문을 통해 데이터 작업을 수행합니다. 2) 데이터베이스 설계 및 관리에 대한 생성, 변경, 삭제 문을 사용하십시오. 3) 복잡한 쿼리 및 데이터 분석은 SQL을 통해 구현되어 비즈니스 의사 결정 효율성을 향상시킵니다.

MySQL의 기본 작업에는 데이터베이스, 테이블 작성 및 SQL을 사용하여 데이터에서 CRUD 작업을 수행하는 것이 포함됩니다. 1. 데이터베이스 생성 : createAbasemy_first_db; 2. 테이블 만들기 : CreateTableBooks (idintauto_incrementprimarykey, titlevarchar (100) notnull, authorvarchar (100) notnull, published_yearint); 3. 데이터 삽입 : InsertIntobooks (Title, Author, Published_year) VA


핫 AI 도구

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

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

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

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

Dreamweaver Mac版
시각적 웹 개발 도구

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

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

MinGW - Windows용 미니멀리스트 GNU
이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.
