----- Original Message -----
From: "Tadej Guzej" <[EMAIL PROTECTED]>
> How would I log connections to MySQL server?
> I need the time user connects and the time user disconnects.
It's a workaround, but the general MySQL log actually has this information.
Here's a sample:
/usr/sbin/mysqld, Version: 3.23.40-log, started with:
Tcp port: 3306 Unix socket: /var/lib/mysql/mysql.sock
Time Id Command Argument
010314 21:56:41 3 Connect [EMAIL PROTECTED] on
[...]
010314 22:00:00 3 Quit
010314 22:31:23 4 Connect Access denied for user:
'[EMAIL PROTECTED]' (Using password: YES)
010314 22:32:02 5 Connect [EMAIL PROTECTED]
[...]
010314 22:33:30 5 Quit
As you see you have the time and date, then the connection ID, then the
command.
You just pick the Connect and Quit commands (probably you need client aborts
as well) for each connection ID with the date/time, and pick the address
from the connect line.
If you do log rotation, you can use a simple script to analyse the old log
and stuff the results into a database table (just don't forget that the
connection ID will be reset if you restart the server so you can't use it as
a unique key in the table).
Chances are someone has already done something like this so you may just be
able to find the script on the net!
Will this do what you require?
Regards,
Arjen.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php