mySql general administrative stuffs

Showing some logons information.


-bash-3.2$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 59
Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select user, host, password from mysql.user order by user, host;
+------+---------------+------------------+
| user | host          | password         |
+------+---------------+------------------+
|      | localhost     |                  |
|      | mysql         |                  |
| root | xx.xxx.xxx.xxx| 5d88439630a903db |
| root | 127.0.0.1     |                  |
| root | localhost     | 5d88439630a903db |
| root | mysql         |                  |
+------+---------------+------------------+
6 rows in set (0.03 sec)


Showing interesting instance information.


mysql> status
--------------
mysql  Ver 14.12 Distrib 5.0.95, for redhat-linux-gnu (x86_64) using readline 5.1

Connection id:          59
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.0.95 Source distribution
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:                 103 days 7 hours 23 min 26 sec

Threads: 1  Questions: 385  Slow queries: 0  Opens: 25  Flush tables: 1  Open tables: 13  Queries per second avg: 0.000
--------------


Show the detail of engine INNODB .. this will reveal a lot of other instance related stuffs as well.


mysql> SHOW ENGINE INNODB STATUS
    -> ;
+------------+
|
=====================================
141119 15:16:07 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 16 seconds
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 3, signal count 3
Mutex spin waits 0, rounds 20, OS waits 1
RW-shared spins 4, OS waits 2; RW-excl spins 1, OS waits 0
------------
TRANSACTIONS
------------
Trx id counter 0 1280
Purge done for trx's n:o < 0 0 undo n:o < 0 0
History list length 0
Total number of lock structs in row lock hash table 0
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 0, not started, process no 3919, OS thread id 1165130048
MySQL thread id 59, query id 385 localhost root
SHOW ENGINE INNODB STATUS
--------
FILE I/O
--------
I/O thread 0 state: waiting for i/o request (insert buffer thread)
I/O thread 1 state: waiting for i/o request (log thread)
I/O thread 2 state: waiting for i/o request (read thread)
I/O thread 3 state: waiting for i/o request (write thread)
Pending normal aio reads: 0, aio writes: 0,
 ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
Pending flushes (fsync) log: 0; buffer pool: 0
25 OS file reads, 3 OS file writes, 3 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2,
0 inserts, 0 merged recs, 0 merges
Hash table size 17393, used cells 0, node heap has 0 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 0 43655
Log flushed up to   0 43655
Last checkpoint at  0 43655
0 pending log writes, 0 pending chkp writes
8 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 20618000; in additional pool allocated 676096
Buffer pool size   512
Free buffers       493
Database pages     19
Modified db pages  0
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages read 19, created 0, written 0
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
1 read views open inside InnoDB
Main thread process no. 3919, id 1164331328, state: waiting for server activity
Number of rows inserted 0, updated 0, deleted 0, read 0
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================
 |
+------+
1 row in set (0.05 sec)


Showing tables that have once been accessed. A way to track db locks on table level.


mysql> show open tables;
+----------+---------------------------+--------+-------------+
| Database | Table                     | In_use | Name_locked |
+----------+---------------------------+--------+-------------+
| mysql    | user                      |      0 |           0 |
| mysql    | columns_priv              |      0 |           0 |
| mysql    | time_zone                 |      0 |           0 |
| vdb      | vpx_version               |      0 |           0 |
| mysql    | time_zone_transition      |      0 |           0 |
| mysql    | db                        |      0 |           0 |
| mysql    | time_zone_transition_type |      0 |           0 |
| mysql    | tables_priv               |      0 |           0 |
| mysql    | procs_priv                |      0 |           0 |
| mysql    | time_zone_name            |      0 |           0 |
| test     | vpx_version               |      0 |           0 |
| mysql    | host                      |      0 |           0 |
+----------+---------------------------+--------+-------------+
12 rows in set (0.00 sec)

mysql>

Another way to look at table locks.





mysql> show full processlist;

+----+------+-----------+------+---------+------+-------+-----------------------+
| Id | User | Host      | db   | Command | Time | State | Info                  |
+----+------+-----------+------+---------+------+-------+-----------------------+
| 60 | root | localhost | NULL | Query   |    0 | NULL  | show full processlist |
+----+------+-----------+------+---------+------+-------+-----------------------+
1 row in set (0.00 sec)


No comments:

Post a Comment