flyonok

统计

留言簿(8)

ACE

book

boost

bsd

c study

c++

code download

codeblock

computer clound

Eclipse

embed system

erlang

ET++

gtk

ic card

java

KDE

libevent

linux

linux--MM

mysql

network education

one card

oracle

pcap relation

php

powerbuilder

python

QT

software config

software test

SQL server

UML

wireless

wxwidgets

陈宾

阅读排行榜

评论排行榜

mysql的当前用户

MYSQL有个命令可以列出所有当前连接( show processlist; ),但由于其结果集不是普通的查询结果集,程序处理时可能有问题,建议使用以下SQL语句:
 
select id,user as user_,host,db,command,time,state from information_schema.PROCESSLIST
 
Oracle的SQL语句:
select * from v$session where username is not null order by logon_time, sid


为保持和上面MySQL的字段对应关系,还可以这样改下:

select sid as id,username as user_, machine as host,schemaname as db,action as command,'' as time,status as state from v$session where username is not null order by logon_time, sid


posted on 2012-01-29 17:07 flyonok 阅读(382) 评论(0)  编辑 收藏 引用 所属分类: mysql


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理