Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1
Examine what these status reports mean:
ƒ Uptime—The number of seconds since the mysqld daemon was started.
ƒ Threads—The number of threads, or clients, that are currently active. This will always
be at least 1 because it includes the thread running the mysqladmin command.
ƒ Questions—The number of queries that mysqld has received since it was started.
ƒ Slow queries—The number of queries that have taken longer than a specified time to
execute. This time is specified by long_query_time, which can be inspected by
running mysqladmin extended-status.
ƒ Opens—The number of tables that have been opened since the MySQL server was
started.
ƒ Flush tables—The number of flush, reload, and refresh commands that have
been issued since the server was started.
ƒ Open tables—The number of tables that are currently open.
Now look at a slightly more user-friendly option, mysqladmin version:
[tonyb@tigger tonyb]$ mysqladmin version
mysqladmin Ver 7.11 Distrib 3.22.27, for pc-linux-gnu on i686
TCX Datakonsult AB, by Monty

Server version 3.22.27-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 23 hours 54 min 19 sec

Threads: 1 Questions: 300 Slow queries: 0 Opens: 30
Flush tables: 1 Open tables: 26
Much of the information, in fact the last two lines, is the same as for status, except that Uptime is now
in hours, minutes, and seconds. However, there is a useful display of other information.

It tells the version of MySQL I am running and the communications protocol version. You may need this
information for debugging if you are running software that uses the MySQL communications protocol
directly.

It tells how I am connected to MySQL—in this case, via a UNIX socket because I am logged on to the
server using Telnet.

Because I am logged on in this way, I also get the UNIX socket specified. If I were connecting to MySQL
via TCP/IP, you would see the TCP port number instead.
There are two more commands, mysqladmin extended-variables and variables, that provide
more detailed information about current server status.

Thread Information


You can look at what MySQL is doing currently by running the mysqladmin processlist command, as
follows:


[tonyb@tigger tonyb]$ mysqladmin -u root -p processlist
Enter password:
+----+------+------------+----------+-----------+------+-------+------+
| Id | User | Host _| db ______| Command | Time | State | Info |
+----+------+------------+----------+-----------+------+-------+------+
| 36 | dave | domain.com | phone_db | Sleep____ | 0 | | |
| 37 | root | localhost _| ______ | Processes | 0 | | |
+----+------+------------+----------+-----------+------+-------+------+
Free download pdf