MySQL 如何使用命令行获取mysql服务器信息?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3939803/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get mysql server info using command line?
提问by user476554
Is there a direct command line command that provides all mysql server information like below...This is provided using Mysql GUI administrator. Do we have some direct command to get this info ussing command line ?
是否有一个直接的命令行命令可以提供所有 mysql 服务器信息,如下所示......这是使用 Mysql GUI 管理员提供的。我们是否有一些直接命令可以使用命令行获取此信息?
Username:
Hostname:
Port:
Server Information
MySQL Version:
Network Name:
IP:
Client Information
Version:
Network name:
IP:
Operating System:
Hardware:
用户
名:主机名:
端口:
服务器信息
MySQL 版本:
网络名称:
IP:
客户端信息
版本:
网络名称:
IP:
操作系统:
硬件:
回答by Naveed
Look at following MySQL documentation:
查看以下 MySQL 文档:
Following command will show you most of your desired information:
以下命令将显示您所需的大部分信息:
SHOW VARIABLES;
Only version:
唯一版本:
select version();
EDIT:
编辑:
What is the difference between show variables and show status?
显示变量和显示状态有什么区别?
SHOW STATUSprovides server status information like Connections, Opened_tables, Bytes_received, Bytes_sent, etc.
SHOW STATUS提供了诸如服务器状态信息Connections,Opened_tables,Bytes_received,Bytes_sent,等。
SHOW VARIABLESshows the values of MySQL system variables like time_zone, version, max_connections, etc.
SHOW VARIABLES显示MySQL的系统变量一样的值time_zone,version,max_connections,等。
回答by Messa
Try just status:
试试吧status:
mysql> status
--------------
mysql Ver 14.14 Distrib 5.5.33, for osx10.7 (i386) using readline 5.1
Connection id: 3
Current database: somedb
Current user: someuser@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.33 Source distribution
Protocol version: 10
Connection: 127.0.0.1 via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 38 min 53 sec
Threads: 2 Questions: 196 Slow queries: 0 Opens: 87 Flush tables: 1 Open tables: 80 Queries per second avg: 0.084
--------------

