Re: InnoDB corrupt after power failure

2012-10-04 Thread Manuel Arostegui
2012/10/4 Andrew Miklas and...@pagerduty.com

 Hi guys,

 I recently had a data corruption issue with InnoDB.  MySQL was shut down
 improperly (power failure), and when the system came back up, MySQL refused
 to start.  On inspection of the logs (see below), it looks like the
 tablespace became seriously corrupted.  In the end, I had to rebuild the
 slave using mysqldump.

 I'm curious what happened here, since I thought InnoDB wasn't supposed to
 become corrupted on an improper shutdown.  One possibility that we were
 exploring was that the filesystem journal setting was incorrect.  We were
 using ext3 with the journal set to writeback mode.  Is this a known bad
 config with InnoDB?


Hey Andrew,

it shouldn't be a biggie if you have a BBU. Do you guys use HW RAID + BBU?
What's your innodb_flush_log_at_trx_commit value?

Have you tried playing with innodb_force_recovery option to try to get the
server started at least? That way you might be able to identify which
table(s) is/are the corrupted one and the one(s) preventing the whole
server from booting up.

Manuel


(real) silly question about variables...

2012-10-04 Thread MAS!
Hi

I know there'd be a reason, but I can't understand that..

mysql select @valore:=rand(), @valore, @valore:=ciao, @valore;
+---+---+-+-+
| @valore:=rand()   | @valore   | @valore:=ciao | @valore |
+---+---+-+-+
| 0.483624490428366 | 0.483624490428366 | ciao|   0 |
+---+---+-+-+
1 row in set (0.00 sec)

mysql select @valore:=rand(), @valore, @valore:=ciao, @valore;
+---+---+-+-+
| @valore:=rand()   | @valore   | @valore:=ciao | @valore |
+---+---+-+-+
| 0.747058809499311 | 0.747058809499311 | ciao| ciao|
+---+---+-+-+
1 row in set (0.00 sec)

why in the first execution the latest value is 0 and not 'ciao'?
and why in the first 2 columns the variables seems works as expected!?

thank you in advance

bye
MAS!


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: (real) silly question about variables...

2012-10-04 Thread Derek Downey
Hrm, what version of MySQL? I just ran the query on 5.5.24 and it worked as 
expected.

- Derek Downey

On Oct 4, 2012, at 9:52 AM, MAS! wrote:

 Hi
 
 I know there'd be a reason, but I can't understand that..
 
 mysql select @valore:=rand(), @valore, @valore:=ciao, @valore;
 +---+---+-+-+
 | @valore:=rand()   | @valore   | @valore:=ciao | @valore |
 +---+---+-+-+
 | 0.483624490428366 | 0.483624490428366 | ciao|   0 |
 +---+---+-+-+
 1 row in set (0.00 sec)
 
 mysql select @valore:=rand(), @valore, @valore:=ciao, @valore;
 +---+---+-+-+
 | @valore:=rand()   | @valore   | @valore:=ciao | @valore |
 +---+---+-+-+
 | 0.747058809499311 | 0.747058809499311 | ciao| ciao|
 +---+---+-+-+
 1 row in set (0.00 sec)
 
 why in the first execution the latest value is 0 and not 'ciao'?
 and why in the first 2 columns the variables seems works as expected!?
 
 thank you in advance
 
 bye
 MAS!
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql
 


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: (real) silly question about variables...

2012-10-04 Thread rich gray


On 04/10/2012 15:52, MAS! wrote:

Hi

I know there'd be a reason, but I can't understand that..

mysql select @valore:=rand(), @valore, @valore:=ciao, @valore;
+---+---+-+-+
| @valore:=rand()   | @valore   | @valore:=ciao | @valore |
+---+---+-+-+
| 0.483624490428366 | 0.483624490428366 | ciao|   0 |
+---+---+-+-+
1 row in set (0.00 sec)

mysql select @valore:=rand(), @valore, @valore:=ciao, @valore;
+---+---+-+-+
| @valore:=rand()   | @valore   | @valore:=ciao | @valore |
+---+---+-+-+
| 0.747058809499311 | 0.747058809499311 | ciao| ciao|
+---+---+-+-+
1 row in set (0.00 sec)

why in the first execution the latest value is 0 and not 'ciao'?
and why in the first 2 columns the variables seems works as expected!?

what version of MySQL are you running? I get this:-

Server version: 5.5.17-log MySQL Community Server (GPL)

mysql  select @valore:=rand(), @valore, @valore:=ciao, @valore;
+++-+-+
| @valore:=rand()| @valore| @valore:=ciao | @valore |
+++-+-+
| 0.8187706152151997 | 0.8187706152151997 | ciao| ciao|
+++-+-+

Rich

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



RE: (real) silly question about variables...

2012-10-04 Thread Martin Gainty


in a mySQL statement the values are displayed BEFORE assignments are made

Ciao,
No MAS
__ 




Per favore non alterare o perturbare la 
comunicazione


 From: urk...@gmail.com
 Subject: (real) silly question about variables...
 Date: Thu, 4 Oct 2012 15:52:20 +0200
 To: mysql@lists.mysql.com
 
 Hi
 
 I know there'd be a reason, but I can't understand that..
 
 mysql select @valore:=rand(), @valore, @valore:=ciao, @valore;
 +---+---+-+-+
 | @valore:=rand()   | @valore   | @valore:=ciao | @valore |
 +---+---+-+-+
 | 0.483624490428366 | 0.483624490428366 | ciao|   0 |
 +---+---+-+-+
 1 row in set (0.00 sec)
 
 mysql select @valore:=rand(), @valore, @valore:=ciao, @valore;
 +---+---+-+-+
 | @valore:=rand()   | @valore   | @valore:=ciao | @valore |
 +---+---+-+-+
 | 0.747058809499311 | 0.747058809499311 | ciao| ciao|
 +---+---+-+-+
 1 row in set (0.00 sec)
 
 why in the first execution the latest value is 0 and not 'ciao'?
 and why in the first 2 columns the variables seems works as expected!?
 
 thank you in advance
 
 bye
 MAS!
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql
 
  

Re: (real) silly question about variables...

2012-10-04 Thread MAS!
 what version of MySQL are you running? I get this:-

mysql select version();
+---+
| version() |
+---+
| 5.1.63-0+squeeze1 |
+---+

I'm asking that because I have a trouble with a select..
I have something similar..

SELECT @sec:=IF(GROUP_CONCAT(DISTINCT secA.sec_code  SEPARATOR '|') is null,


   IF(GROUP_CONCAT(DISTINCT secB.sec_code  SEPARATOR '|') is null, 
settore, GROUP_CONCAT(DISTINCT secB.sec_code  SEPARATOR '|')),  
   
 GROUP_CONCAT(DISTINCT secA.sec_code  SEPARATOR '|') ) as 
settore,  
SELECT CASE(
   WHEN SUBSTR(@sec,1,23)=... THEN ...
   WHEN SUBSTR(@sec,1,12)=... THEN ...
   WHEN SUBSTR(@sec,1,34)=... THEN ...
   )
 FROM (several left joins)

and it seems the sec variable is always the 'previous one' and not the result 
from the nested 'if' :(



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



user last activity and log in

2012-10-04 Thread Aastha
Hello,

I want to find the last time the given list of users logged in.
Is there any mysql table from where i can retrieve the data or anyt
specific sql


Aastha Gupta


Re: user last activity and log in

2012-10-04 Thread List Man
There is no such thing.  Your application has to deal with such info.

LS


On Oct 4, 2012, at 11:28 AM, Aastha wrote:

 Hello,
 
 I want to find the last time the given list of users logged in.
 Is there any mysql table from where i can retrieve the data or anyt
 specific sql
 
 
 Aastha Gupta


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: user last activity and log in

2012-10-04 Thread Reindl Harald


Am 04.10.2012 17:28, schrieb Aastha:
 I want to find the last time the given list of users logged in.
 Is there any mysql table from where i can retrieve the data or any
 specific sql

no - because this would mean a WRITE QUERY in the mysql-database
for every connection - having a web-application with hundrets
of calls per second would kill the performance

this makes pretty no sense and is NOT the job of a RDBMS
implement it in your application / db-abstraction-layer



signature.asc
Description: OpenPGP digital signature


Re: user last activity and log in

2012-10-04 Thread Singer Wang
It is possible in MySQL 5.6

S


On Thu, Oct 4, 2012 at 11:30 AM, List Man list@bluejeantime.com wrote:

 There is no such thing.  Your application has to deal with such info.

 LS


 On Oct 4, 2012, at 11:28 AM, Aastha wrote:

  Hello,
 
  I want to find the last time the given list of users logged in.
  Is there any mysql table from where i can retrieve the data or anyt
  specific sql
 
 
  Aastha Gupta


 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql




Re: user last activity and log in

2012-10-04 Thread Johan De Meersman

- Original Message -
 From: Reindl Harald h.rei...@thelounge.net
 
 this makes pretty no sense and is NOT the job of a RDBMS
 implement it in your application / db-abstraction-layer

I notice no specification of what kind of users, so I'm assuming DB users. 
There *is* such a thing: you can find it in the general query log. Turning that 
on is a considerable performance overhead, though, and so is firmly discouraged 
on production systems.


-- 
Linux Bier Wanderung 2012, now also available in Belgium!
August, 12 to 19, Diksmuide, Belgium - http://lbw2012.tuxera.be

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: user last activity and log in

2012-10-04 Thread Aastha
Yes, i meant DB users.

On Thu, Oct 4, 2012 at 10:57 AM, Johan De Meersman vegiv...@tuxera.bewrote:


 - Original Message -
  From: Reindl Harald h.rei...@thelounge.net
 
  this makes pretty no sense and is NOT the job of a RDBMS
  implement it in your application / db-abstraction-layer

 I notice no specification of what kind of users, so I'm assuming DB users.
 There *is* such a thing: you can find it in the general query log. Turning
 that on is a considerable performance overhead, though, and so is firmly
 discouraged on production systems.


 --
 Linux Bier Wanderung 2012, now also available in Belgium!
 August, 12 to 19, Diksmuide, Belgium - http://lbw2012.tuxera.be

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql




Re: user last activity and log in

2012-10-04 Thread Reindl Harald
it does not matter what kind of users

usually each application has it's own datanase and it's
own user, the application makes the connection and
can at this point log whatever you want

using the general query log can only be a bad joke
you will log EVERY query and not only logins

again: it is not the job of a RDBMS to waste I/O and
performance with such things - the application as
example could refresh it only once per user-session

the RDBMS would write blindly for each connection

Am 04.10.2012 18:18, schrieb Aastha:
 Yes, i meant DB users.
 
 On Thu, Oct 4, 2012 at 10:57 AM, Johan De Meersman vegiv...@tuxera.be 
 mailto:vegiv...@tuxera.be wrote:
 
 
 - Original Message -
  From: Reindl Harald h.rei...@thelounge.net 
 mailto:h.rei...@thelounge.net
 
  this makes pretty no sense and is NOT the job of a RDBMS
  implement it in your application / db-abstraction-layer
 
 I notice no specification of what kind of users, so I'm assuming DB 
 users. There *is* such a thing: you can
 find it in the general query log. Turning that on is a considerable 
 performance overhead, though, and so is
 firmly discouraged on production systems.



signature.asc
Description: OpenPGP digital signature


Re: user last activity and log in

2012-10-04 Thread Johan De Meersman
- Original Message -
 From: Reindl Harald rei...@thelounge.net
 
 it does not matter what kind of users

I'm happy for you that you still have all the answers anyone could ever want, 
Harald. Regardless of having any background knowledge on the circumstance of 
the question, even. You truly are a gifted individual.

 using the general query log can only be a bad joke
 you will log EVERY query and not only log-ins

Yes, which is why I specified explicitly that it is very much discouraged for 
production use.

However, it can be useful at times. I recently turned it on to investigate 
sudden, unpredictable and above all annoyingly brief peaks in the number of 
connections, and I needed to know what APPLICATION INSTANCE was responsible, 
not which particular user - as well as have a good view of what the offending 
sessions did. A tcpdump would have been an option, but given that wireshark 
still isn't too good at decoding MySQL traffic I still opted for the full query 
log. There was some more tomfoolery involved, but after almost a week of 
logging we successfully identified the culprit.

Now you may do things differently, and you may also reach a satisfactory 
solution; but I am absolutely sick and tired of hearing how your way is the 
only valid way, casually implying that the rest of the world are all bloody 
idiots that should just shut up and listen while you tell them every ridiculous 
way in which they are wrong and inferior. 

PLEASE, for your own sake - not to mention the nerves of the people around you 
- learn to accept that there are a lot of different ways to do things, and that 
sometimes people pick their optimal solution on quite different criteria than 
the ones you use. That does not necessarily make them wrong, merely different 
from you. As the Perl mantra goes, There's More Than One Way To Do It.

/Johan

-- 
Linux Bier Wanderung 2012, now also available in Belgium!
August, 12 to 19, Diksmuide, Belgium - http://lbw2012.tuxera.be

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: InnoDB corrupt after power failure

2012-10-04 Thread Andrew Miklas
Hi Manuel,

Thanks for the fast reply.

On Oct 4, 2012, at 12:05 AM, Manuel Arostegui wrote:
snip
 it shouldn't be a biggie if you have a BBU. Do you guys use HW RAID + BBU?

We've checked with our hosting provider, and the database was indeed stored on 
a BBU RAID.

 What's your innodb_flush_log_at_trx_commit value?

mysql show variables like 'innodb_flush_log_at_trx_commit'\G
*** 1. row ***
Variable_name: innodb_flush_log_at_trx_commit
Value: 1
1 row in set (0.00 sec)


 Have you tried playing with innodb_force_recovery option to try to get the 
 server started at least? That way you might be able to identify which 
 table(s) is/are the corrupted one and the one(s) preventing the whole server 
 from booting up. 

As the affected machine was just a read only slave, it was easier for me to get 
things back into service by just reloading off the master.  Unfortunately, I 
didn't think to keep the corrupted ibd files for later debugging.

At this point, I'm more trying to figure out if there's something wrong with 
the DB or host config.  There was effectively no data loss, but I'm worried we 
might have data loss or availability issues if this error crops up on our 
master server.


Thanks,


Andrew


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: user last activity and log in

2012-10-04 Thread Reindl Harald


Am 04.10.2012 23:12, schrieb Johan De Meersman:
 - Original Message -
 From: Reindl Harald rei...@thelounge.net

 it does not matter what kind of users
 
 I'm happy for you that you still have all the answers anyone could ever want, 
 Harald.

not all but the one to the topic

IT IS IMPOSSIBLE
MYSQL CAN NOT DO WHAT THE OP WANT

 Regardless of having any background knowledge on the circumstance of the 
 question, even.

mysql can not an dwill not log user-logins

 You truly are a gifted individual.

your opinion, but the answer to the question of the OP
is simply NO you can't

 using the general query log can only be a bad joke
 you will log EVERY query and not only log-ins
 
 Yes, which is why I specified explicitly that it is very much discouraged for 
 production use.

it is NOT the answer to the question damned
it doe NOT log the last login of a mysql user in a USEABLE form

 Now you may do things differently, and you may also reach a satisfactory 
 solution; 
 but I am absolutely sick and tired of hearing how your way is the only valid 
 way

i don't give a damn about what you are tired of

the answer to I want to find the last time the given list of users
logged in. Is there any mysql table from where i can retrieve the data
is SIMPLY NO and not a useless full query log

 casually implying that the rest of the world are all bloody idiots 

maybe in this case your conclusion i liked to call you
a bloody idiot for bringing full query log as answer
comes because you realized how useless the idea is

 that should just shut up and listen while you tell them every ridiculous 
 way in which they are wrong and inferior

maybe you should shut up yourself as long
you are hypersensible

 learn to accept that there are a lot of different ways to do things

again: your solution full query log is not one
if you can't face the truth this is your problem

 and that sometimes people pick their optimal solution on quite different 
 criteria than the ones you use. 

if someone does not like answers he should not ask questions

 There's More Than One Way To Do It.

full query og is none of them

if it takes SIX hours for your reply in the way you did here
my conclusion is that you recently came home drunken and should
go to bed



signature.asc
Description: OpenPGP digital signature


RE: InnoDB corrupt after power failure

2012-10-04 Thread Rick James
I hope you turned OFF caching on the drives, themselves.  The BBU should be the 
single place that caches and is trusted to survive a power outage.

 -Original Message-
 From: Andrew Miklas [mailto:and...@pagerduty.com]
 Sent: Thursday, October 04, 2012 2:16 PM
 To: Manuel Arostegui
 Cc: mysql@lists.mysql.com
 Subject: Re: InnoDB corrupt after power failure
 
 Hi Manuel,
 
 Thanks for the fast reply.
 
 On Oct 4, 2012, at 12:05 AM, Manuel Arostegui wrote:
 snip
  it shouldn't be a biggie if you have a BBU. Do you guys use HW RAID +
 BBU?
 
 We've checked with our hosting provider, and the database was indeed
 stored on a BBU RAID.
 
  What's your innodb_flush_log_at_trx_commit value?
 
 mysql show variables like 'innodb_flush_log_at_trx_commit'\G
 *** 1. row ***
 Variable_name: innodb_flush_log_at_trx_commit
 Value: 1
 1 row in set (0.00 sec)
 
 
  Have you tried playing with innodb_force_recovery option to try to
 get the server started at least? That way you might be able to identify
 which table(s) is/are the corrupted one and the one(s) preventing the
 whole server from booting up.
 
 As the affected machine was just a read only slave, it was easier for
 me to get things back into service by just reloading off the master.
 Unfortunately, I didn't think to keep the corrupted ibd files for later
 debugging.
 
 At this point, I'm more trying to figure out if there's something wrong
 with the DB or host config.  There was effectively no data loss, but
 I'm worried we might have data loss or availability issues if this
 error crops up on our master server.
 
 
 Thanks,
 
 
 Andrew
 
 
 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: InnoDB corrupt after power failure

2012-10-04 Thread Andrew Miklas
Hi Rick,

On Oct 4, 2012, at 2:40 PM, Rick James wrote:

 I hope you turned OFF caching on the drives, themselves.  The BBU should be 
 the single place that caches and is trusted to survive a power outage.

The DB server in question is running in a virtualized environment, so the array 
shows up as a SCSI device inside our VM.  I can't use hdparm to directly check 
whether the disks are doing write caching, but our hosting provider assures us 
that once data is sent to the virtual SCSI device from inside the VM, it will 
be persisted to disk even if there's a power failure.

I'm a bit suspicious of a recent change we did to switch our ext3 journals from 
data=ordered to data=writeback.  The ext3 docs say a crash+recovery can cause 
incorrect data to appear in files which were written shortly before the crash 
[1].  As a result, if a tablespace were extended just before the power failure, 
it might be possible that when MySQL restarts, it will see random data at the 
end of the tablespace.  It seems like this could happen even if the disks are 
BBU / not write caching, because the increase of the ibd's file size in the 
inode and the zeroing out of the new blocks assigned to the file are not atomic 
with respect to one another.

Is the InnoDB recovery process OK with this scenario?  Has anyone else seen 
corruption problems with data=writeback?


-- Andrew


[1] http://lxr.linux.no/linux+v3.5.2/Documentation/filesystems/ext3.txt
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: user last activity and log in

2012-10-04 Thread Claudio Nanni
Hi,

2012/10/4 Reindl Harald h.rei...@thelounge.net



 Am 04.10.2012 17:28, schrieb Aastha:
  I want to find the last time the given list of users logged in.
  Is there any mysql table from where i can retrieve the data or any
  specific sql

 no - because this would mean a WRITE QUERY in the mysql-database
 for every connection - having a web-application with hundrets
 of calls per second would kill the performance

 No because MySQL does not have this facility. (5.6)
Saying that a feature is not present because the hypothetical
implementation would impact performance doesn't make much sense in my
opinion.


 this makes pretty no sense and is NOT the job of a RDBMS
 implement it in your application / db-abstraction-layer


I can suggest a reading here:
http://www.amazon.com/Implementing-Database-Security-Auditing-Examples/dp/183342

Regards
-- 
Claudio


RE: InnoDB corrupt after power failure

2012-10-04 Thread Rick James
On Linux, XFS is preferred.  Noop or Deadline, not CFQ is preferred.
I don't know if any of this has any impact on the crash you describe.

I am quite suspicious of VMs.

 -Original Message-
 From: Andrew Miklas [mailto:and...@pagerduty.com]
 Sent: Thursday, October 04, 2012 3:21 PM
 To: Rick James
 Cc: Manuel Arostegui; mysql@lists.mysql.com
 Subject: Re: InnoDB corrupt after power failure
 
 Hi Rick,
 
 On Oct 4, 2012, at 2:40 PM, Rick James wrote:
 
  I hope you turned OFF caching on the drives, themselves.  The BBU
 should be the single place that caches and is trusted to survive a
 power outage.
 
 The DB server in question is running in a virtualized environment, so
 the array shows up as a SCSI device inside our VM.  I can't use hdparm
 to directly check whether the disks are doing write caching, but our
 hosting provider assures us that once data is sent to the virtual SCSI
 device from inside the VM, it will be persisted to disk even if there's
 a power failure.
 
 I'm a bit suspicious of a recent change we did to switch our ext3
 journals from data=ordered to data=writeback.  The ext3 docs say a
 crash+recovery can cause incorrect data to appear in files which were
 written shortly before the crash [1].  As a result, if a tablespace
 were extended just before the power failure, it might be possible that
 when MySQL restarts, it will see random data at the end of the
 tablespace.  It seems like this could happen even if the disks are BBU
 / not write caching, because the increase of the ibd's file size in the
 inode and the zeroing out of the new blocks assigned to the file are
 not atomic with respect to one another.
 
 Is the InnoDB recovery process OK with this scenario?  Has anyone else
 seen corruption problems with data=writeback?
 
 
 -- Andrew
 
 
 [1] http://lxr.linux.no/linux+v3.5.2/Documentation/filesystems/ext3.txt

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



RE: user last activity and log in

2012-10-04 Thread Rick James
In looking at a couple hundred machine, I see that
  Connections / Uptime
has a median of about 0.5 (one connection every 2 seconds)
and a max of about 140.

140 writes to some audit table _might_ have a small impact on the system.

 -Original Message-
 From: Claudio Nanni [mailto:claudio.na...@gmail.com]
 Sent: Thursday, October 04, 2012 3:51 PM
 To: Reindl Harald
 Cc: mysql@lists.mysql.com
 Subject: Re: user last activity and log in
 
 Hi,
 
 2012/10/4 Reindl Harald h.rei...@thelounge.net
 
 
 
  Am 04.10.2012 17:28, schrieb Aastha:
   I want to find the last time the given list of users logged in.
   Is there any mysql table from where i can retrieve the data or any
   specific sql
 
  no - because this would mean a WRITE QUERY in the mysql-database for
  every connection - having a web-application with hundrets of calls
 per
  second would kill the performance
 
  No because MySQL does not have this facility. (5.6)
 Saying that a feature is not present because the hypothetical
 implementation would impact performance doesn't make much sense in my
 opinion.
 
 
  this makes pretty no sense and is NOT the job of a RDBMS implement it
  in your application / db-abstraction-layer
 
 
 I can suggest a reading here:
 http://www.amazon.com/Implementing-Database-Security-Auditing-
 Examples/dp/183342
 
 Regards
 --
 Claudio

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: user last activity and log in

2012-10-04 Thread Reindl Harald
beside the fact that msql CAN NOT do this at all

the median is not really releavt
in the median you see also night hours with zero load

on a typical webserver with load you have much more

* a cms system
* many page requests per second
* no you can not use persistent connections if you have
  let's say 100 databases and 100 domains with 500 prefork
  pcroesses because these would mean in the worst case 5
  connections
* enable query log on machines with some hundret queriers
  per second would be a self DOS and fill your disks

Am 05.10.2012 01:26, schrieb Rick James:
 In looking at a couple hundred machine, I see that
 Connections / Uptime
 has a median of about 0.5 (one connection every 2 seconds)
 and a max of about 140.
 
 140 writes to some audit table _might_ have a small impact on the system.
 
 -Original Message-
 From: Claudio Nanni [mailto:claudio.na...@gmail.com]
 Sent: Thursday, October 04, 2012 3:51 PM
 To: Reindl Harald
 Cc: mysql@lists.mysql.com
 Subject: Re: user last activity and log in

 Hi,

 2012/10/4 Reindl Harald h.rei...@thelounge.net



 Am 04.10.2012 17:28, schrieb Aastha:
 I want to find the last time the given list of users logged in.
 Is there any mysql table from where i can retrieve the data or any
 specific sql

 no - because this would mean a WRITE QUERY in the mysql-database for
 every connection - having a web-application with hundrets of calls
 per
 second would kill the performance

 No because MySQL does not have this facility. (5.6)
 Saying that a feature is not present because the hypothetical
 implementation would impact performance doesn't make much sense in my
 opinion.


 this makes pretty no sense and is NOT the job of a RDBMS implement it
 in your application / db-abstraction-layer


 I can suggest a reading here:
 http://www.amazon.com/Implementing-Database-Security-Auditing-
 Examples/dp/183342



signature.asc
Description: OpenPGP digital signature


Re: user last activity and log in

2012-10-04 Thread Keith Murphy
My friend Dave Holoboff wrote this up some time ago:

http://mysqlhints.blogspot.com/2011/01/how-to-log-user-connections-in-mysql.html

You know you people sound like children.

Really  unprofessional.

Go ahead --- call me names. i left middle school almost 30 years ago. It
won't bother me.

Can we knock off the name calling and actually offer advice and possible
solutions? I thought that was what this list was for.

For those of us out in the field doing things ... This might be your
ticket. It requires a restart of MySQL (which may or may not be acceptable)
bit it's a fairly clean solution.

Minimal load, easy to query for your last connection time and how often
connections are made by a user.

Again, requires a restart to enable (and disable) . Oh, and users with
super privileges won't be logged.

Thanks,

Keith

--

Keith Murphy
Senior MySQL DBA
Principal Trainer
Paragon Consulting Services
http://www.paragon-cs.com
850-637-3877







-- 

*
*
(c) 850-637-3877


Re: user last activity and log in

2012-10-04 Thread Keith Murphy
One small correction. Init-connect doesn't require a restart of MySQL.  I
was thinking of init-file. So that's even better.



On Thursday, October 4, 2012, Keith Murphy wrote:

 My friend Dave Holoboff wrote this up some time ago:


 http://mysqlhints.blogspot.com/2011/01/how-to-log-user-connections-in-mysql.html

 You know you people sound like children.

 Really  unprofessional.

 Go ahead --- call me names. i left middle school almost 30 years ago. It
 won't bother me.

 Can we knock off the name calling and actually offer advice and possible
 solutions? I thought that was what this list was for.

 For those of us out in the field doing things ... This might be your
 ticket. It requires a restart of MySQL (which may or may not be acceptable)
 bit it's a fairly clean solution.

 Minimal load, easy to query for your last connection time and how often
 connections are made by a user.

 Again, requires a restart to enable (and disable) . Oh, and users with
 super privileges won't be logged.

 Thanks,

 Keith

 --

 Keith Murphy
 Senior MySQL DBA
 Principal Trainer
 Paragon Consulting Services
 http://www.paragon-cs.com
 850-637-3877







 --

 *
 *
 (c) 850-637-3877



-- 

Keith Murphy
Senior MySQL DBA
Principal Trainer
Paragon Consulting Services
http://www.paragon-cs.com
850-637-3877