The select user() command shows who you are logged in as:
UNIX > mysql -u andrew -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.19 MySQL Community Server (GPL)
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> use test;
Database changed
mysql> select user();
+------------------+
| user() |
+------------------+
| andrew@localhost |
+------------------+
1 row in set (0.00 sec)
mysql>
... and the show processlist command shows who is logged in. I had to shrink it so that it would fit in the screen. The time column shows how long the user has been logged in for in seconds:
UNIX > mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 38
Server version: 5.5.19 MySQL Community Server (GPL)
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> show processlist;
+----+--------+-----------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+--------+-----------+------+---------+------+-------+------------------+
| 37 | andrew | localhost | test | Sleep | 237 | | NULL |
| 38 | root | localhost | NULL | Query | 0 | NULL | show processlist |
+----+--------+-----------+------+---------+------+-------+------------------+
2 rows in set (0.00 sec)
mysql> show processlist;
+----+--------+-----------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+--------+-----------+------+---------+------+-------+------------------+
| 37 | andrew | localhost | test | Sleep | 248 | | NULL |
| 38 | root | localhost | NULL | Query | 0 | NULL | show processlist |
+----+--------+-----------+------+---------+------+-------+------------------+
2 rows in set (0.00 sec)
mysql>
No comments:
Post a Comment