search cancel

How to rotate the MySQL error log file (<hostname.err> in Windows

book

Article ID: 254695

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

There is a huge file (50GB) in the $SPECROOT/mysql/data/ directory on a Windows server called <hostname>.err.

Is there a way to either rotate or delete the current file?

 

Environment

Release : 20.2

Resolution

The $SPECROOT/mysql/data/<hostname>.err file is the MySQL log file in the Windows platform. You can either rename or delete it if you don't want it.

1. Stop the Spectrum Process Daemon, which will also stop the Spectrum MySQL server service.

2. Either rename or delete the $SPECROOT/mysql/data/<hostname>.err file.

3. Start the Spectrum Process Daemon, which will also start the Spectrum MySQL server service.

4. A new $SPECROOT/mysql/data/<hostname>.err file will be created.

===============================

Another way, without stopping the MySQL server and Spectrum Process Daemon services:

Here is my example in the Windows platform, I follow the steps from the previous URL:

https://dev.mysql.com/doc/refman/5.7/en/error-log-rotation.html

1. Open a bash shell (bash -login)

2. Navigate to the $SPECROOT/mysql/data/ directory

$ cd mysql/data

3. Rename the existing MySQL error log file.

$ mv <hostname>.err <hostname>.err_yyyy-mm-dd

4. Run mysqladmin flush-logs command line to the MySQL server close and reopen any error log file to which it is writing.

$ ../bin/mysqladmin.exe flush-logs error -uroot -proot (Spectrum version up to 21.2.2)

$ ../bin/mysqladmin.exe flush-logs error -uroot -pMySqlR00t (Spectrum version 21.2.4 onwards)

A new $SPECROOT/mysql/data/<hostname>.err file will be created.

5. You can now either delete the <hostname>.err_yyyy-mm-dd file or move it to a different location.

Attachments