this will help you
http://adminlinux.blogspot.com/2009/09/mysql-log-file-rotation.html

On Fri, Aug 12, 2011 at 9:43 AM, Paul DuBois <paul.dub...@oracle.com> wrote:

>
> On Aug 11, 2011, at 2:30 PM, Keith Murphy wrote:
>
> > Hey everyone,
> >
> > I have run across something that has me stumped. I have some systems that
> > have very large error logs because we haven't moved from statement-based
> to
> > mixed-based replication yet so they get a lot of warnings logged. I need
> to
> > rotate the error logs and have started looking at it doing so.
> >
> > The problem is that on one system a normal course of action works
> perfectly,
> > but on anther it does not. And these systems were installed from the same
> > RPM packages (5.1.50 -- downloaded from the MySQL website).
> >
> > Here is what I do:
> >
> >
> > log in with mysql client and 'flush logs'  OR mysqladmin --flush-log
> >
> > It should rename the old log file to mysqld.log-old and start a new
> > mysqld.log file.
> >
> > On one system it works perfectly
> >
> > On the other...nothing.
> >
> > I tried moving the error log (mv /var/log/mysqld/mysqld.log
> > /var/log/mysqld.log.old) and then issuing the flush logs command...it
> stays
> > writing to the "old" file and never makes a new one.
> >
> > If I were to restart mysqld it would solve the problem but this is a
> > production system and that isn't very practical.
> >
> > These systems are very similar. my.cnfs have been checked for
> differences. I
> > searched the interwebs and specifically bugs.mysql.com for something
> > similar. Not finding anything.
> >
> > I would appreciate any ideas!
>
>
> There was a change to log flushing that affects the error log in 5.1.51/
> 5.5.7.
> It might be the cause of what you're seeing.
>
> http://dev.mysql.com/doc/refman/5.1/en/news-5-1-51.html
> http://dev.mysql.com/doc/refman/5.5/en/news-5-5-7.html
>
> "
> Incompatible Change: Previously, if you flushed the logs using FLUSH LOGS
> or mysqladmin flush-logs andmysqld was writing the error log to a file (for
> example, if it was started with the --log-error option), it renamed the
> current log file with the suffix -old, then created a new empty log file.
> This had the problem that a second log-flushing operation thus caused the
> original error log file to be lost unless you saved it under a different
> name. For example, you could use the following commands to save the file:
>
> shell> mysqladmin flush-logs
>
> shell> mv host_name.err-old backup-directory
>
> To avoid the preceding file-loss problem, renaming no longer occurs. The
> server merely closes and reopens the log file. To rename the file, you can
> do so manually before flushing. Then flushing the logs reopens a new file
> with the original file name. For example, you can rename the file and create
> a new one using the following commands:
>
> shell> mv host_name.err host_name.err-old
>
> shell> mysqladmin flush-logs
>
> shell> mv host_name.err-old backup-directory
>
> (Bug #29751)
>
> See also Bug #56821.
> "
> --
> Paul DuBois
> Oracle Corporation / MySQL Documentation Team
> Madison, Wisconsin, USA
> www.mysql.com
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=aim.prab...@gmail.com
>
>


-- 
Best Regards,

Prabhat Kumar
MySQL DBA

My Blog: http://adminlinux.blogspot.com
My LinkedIn: http://www.linkedin.com/in/profileprabhat

Reply via email to