How to know the MySQL uptime from commandline

Posted: February 26, 2014 in Databases

In some situations, we need to check the uptime for MySQL in your server. The following command will give you the MySQL version along with the uptime of MySQL process.

Method 1:

# mysqladmin  version

For example:

root@server [~]# mysqladmin version

mysqladmin Ver 8.42 Distrib 5.1.72, for unknown-linux-gnu on x86_64
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Server version 5.1.72-cll
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 5 days 1 hour 28 min 23 sec

Method II:

# mysqladmin  ver

For example:

#mysqladmin ver

mysqladmin Ver 8.42 Distrib 5.1.72, for unknown-linux-gnu on x86_64
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

..

..

Server version 5.1.72-cll
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 5 days 1 hour 29 min 27 sec

Method III:

Switch into mysql and type \s

For example:

mysql> \s
————–
mysql Ver 14.14 Distrib 5.1.72, for unknown-linux-gnu (x86_64) using readline 5.1

Connection id: 75809
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ”
Using delimiter: ;
Server version: 5.1.72-cll MySQL Community Server (GPLv2)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 5 days 1 hour 30 min 22 sec

Threads: 3 Questions: 3363916 Slow queries: 48 Opens: 29366 Flush tables: 1 Open tables: 1800 Queries per second avg: 7.690
————–

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s