How to shrink the log file in MYSQL SERVER

How to shrink the log file in MYSQL SERVER

The transaction log records the operations on the relevant database and also stores information related to database recovery.

There are many reasons to shrink the log, some due to insufficient space, and some due to application limitations.

The following describes the shrinking operation in simple mode.

1. Command line

USE MASTER
GO
ALTER DATABASE {DBName} SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE {DBName} SET RECOVERY SIMPLE --Simple mode GO
USE {DBName}
GO
DBCC SHRINKFILE (N'{DBName}_Log', 8, TRUNCATEONLY)
GO
USE MASTER
GO
ALTER DATABASE {DBName} SET RECOVERY FULL WITH NO_WAIT
GO
ALTER DATABASE {DBName} SET RECOVERY FULL --Restore to full mode

2. Step-by-step operation through the graphical interface

1. Open the database properties window

2. Change the database recovery mode from "full" to "simple"

3. Shrink the database log, "Task" -> "Shrink"

4. After shrinking, change the recovery mode of the database to "full"

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • MySQL series: redo log, undo log and binlog detailed explanation
  • Detailed explanation of MySQL redo log (redo log) and rollback log (undo logo)
  • Summary of 7 types of logs in MySQL
  • MySQL uses binlog logs to implement data recovery
  • Analysis and solution of a MySQL slow log monitoring false alarm problem
  • The role and opening of MySQL slow query log
  • Enabling and configuring MySQL slow query log
  • Undo log in MySQL
  • Detailed explanation of the binlog log analysis tool for monitoring MySQL: Canal
  • Analysis of MySQL Aborted connection warning log
  • Summary of MySQL Undo Log and Redo Log

<<:  Element dynamic routing breadcrumbs implementation example

>>:  Use of Linux sed command

Recommend

How to ensure the overall user experience

Related Articles: Website Design for User Experien...

Vue3.0 routing automatic import method example

1. Prerequisites We use the require.context metho...

Solve the problem of docker pull being reset

This article introduces how to solve the problem ...

Details of the order in which MySQL reads my.cnf

Table of contents The order in which MySQL reads ...

Why is there this in JS?

Table of contents 1. Demand 2. Solution 3. The fi...

This article will show you what Vite does to the browser's request

Table of contents Working principle: What does th...

Implementation of webpack-dev-server to build a local server

Table of contents Preface webpack-deb-server webp...

Vue implements nested routing method example

1. Nested routing is also called sub-routing. In ...

Summary of basic usage of CSS3 @media

//grammar: @media mediatype and | not | only (med...

CentOS7 deploys version 19 of docker (simple, you can follow it)

1. Install dependency packages [root@localhost ~]...

Learn the black technology of union all usage in MySQL 5.7 in 5 minutes

Performance of union all in MySQL 5.6 Part 1:MySQ...

Detailed explanation of the execution process of mysql update statement

There was an article about the execution process ...

How to connect to a remote server and transfer files via a jump server in Linux

Recently, I encountered many problems when deploy...