Results 1 to 5 of 5

Thread: MySQL database log file maintenance

  1. #1
    Join Date
    Feb 2010
    Posts
    570

    MySQL database log file maintenance

    Hi all,

    As Log File Restoration Database an important reference data, so the log file Maintenance also has very important significance. When MySQL used in conjunction with the log files, i sometimes want to remove / backup old log files and tell MySQL to start recording in the new file. This involves opening of the new log files, including updating logs and conventional logs. I want to know that How to maintenance MySQL database log file. Thanks in advance.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    MySQL database log file maintenance

    If you are using only an update log, you only need to empty the log file, and then remove the old update log files to a backup, and then enable the new update log. With the following method can be forced Servers Opening of the new update log:

    Code:
    # mysqladmin flush-logs
    You generally need to use the command line to provide the database user:

    Code:
    mysqladmin-u root-p flush-logs
    Check and reply.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    MySQL database log file maintenance

    You generally need to use the command line to provide the database user:
    Code:
    mysqladmin-u root-p refresh
    If you are using MySQL 3.21 or earlier versions, you must use mysqladmin refresh.
    # SQL commands
    Code:
    FLUSH LOGS
    # restart the server
    These methods have such features:Close and then open the standard and update log files. If you do not specify an extension of the update log files, the new update log file extension numbers will be relatively earlier paper plus 1.
    Code:
    mysql> FLUSH LOGS;
    Check and reply.

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    MySQL database log file maintenance

    You can use the new conventional log. This method can also force an update of conventional logging.Must be prepared to back up the conventional logs, the steps may be more complex:

    Code:
    # Cd mysql-data-directory
    #Mv mysql.log mysql.old
    # Mysqladmin flush-tables
    Then do a backup and delete the "mysql.old".

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    MySQL database log file maintenance

    A log flushing operation does the following:
    # If universal query logging (--log) or slow query logging (--log-slow-queries) to a log file is enabled, the server shut and reopens the common query log file or slow query log file.
    # If binary logging (--log-bin) is used, the server close the current log file and opens a new log file with the subsequently sequence number.
    # If the server was known an error log file name with the --log-error option, it renames the error log with the suffix -old and creates a new empty error log file.

Similar Threads

  1. How to connect PHP to mySQL Database
    By Nathen in forum Tips & Tweaks
    Replies: 2
    Last Post: 17-07-2011, 03:49 AM
  2. Working with MySQL database
    By Garlands in forum Software Development
    Replies: 5
    Last Post: 12-02-2010, 10:36 PM
  3. Replies: 3
    Last Post: 07-11-2009, 09:36 PM
  4. How to convert .db file to MySQL database
    By KALIDA in forum Software Development
    Replies: 3
    Last Post: 07-09-2009, 04:49 PM
  5. Restoring MySQL database
    By Sean J in forum Software Development
    Replies: 5
    Last Post: 18-02-2009, 01:46 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,701,472,750.12805 seconds with 17 queries