user476554
user476554

Reputation: 687

How to get MySQL server info using command line?

Is there a direct command line command that provides all MySQL server information like shown below:

Username:  
Hostname:  
Port:   
**Server Information**  
MySQL Version:   
Network Name:  
IP:   
**Client Information**  
Version:  
Network name:  
IP:  
Operating System:  
Hardware: 

This is provided using MySQL GUI administrator.

Do we have some direct command to get this info using command line?

Upvotes: 25

Views: 93945

Answers (2)

Messa
Messa

Reputation: 25201

Try just 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
--------------

Upvotes: 33

Naveed
Naveed

Reputation: 42133

Look at following MySQL documentation:

SHOW VARIABLES

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 STATUS provides server status information like Connections, Opened_tables, Bytes_received, Bytes_sent, etc.

More Info

SHOW VARIABLES shows the values of MySQL system variables like time_zone, version, max_connections, etc.

More Info

Upvotes: 35

Related Questions