Detailed explanation of how to reduce memory usage in MySql

Detailed explanation of how to reduce memory usage in MySql

Preface

By default, MySQL will initialize a large memory block to cache database query data.

But my small host only has 640MB of memory, and top query found that it ate up 30% of my total memory, almost 200MB.

But there are only a few MB of data in this database, and this setting feels unreasonable.

After searching the article, I finally reduced the memory usage to 128MB

Implementation

Modify /etc/mysql/mysql.conf.d/mysqld.cnf directly

Add the following configuration at the end of the configuration

performance_schema_max_table_instances=150
table_definition_cache=150
table_open_cache=64

Then restart the service with service mysql restart

Effect

Before optimization

After optimization

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:
  • Detailed explanation of the my.ini Chinese configuration scheme for MySql optimization: InnoDB, 4GB memory, and multiple queries
  • Briefly describe the MySQL InnoDB storage engine
  • MySQL learning summary: a preliminary understanding of the architectural design of the InnoDB storage engine
  • MySQL Learning (VII): Detailed Explanation of the Implementation Principle of Innodb Storage Engine Index
  • Summary of the differences between MySQL storage engines MyISAM and InnoDB
  • A Deep Dive into the MySQL InnoDB Storage Engine
  • Detailed analysis of MySQL 8.0 memory consumption
  • Detailed explanation of the usage of MySQL memory tables and temporary tables
  • Summary of MySQL 8.0 memory-related parameters
  • Detailed explanation of memory management of MySQL InnoDB storage engine

<<:  VMware and CentOS system installation method to reset the root password

>>:  WeChat applet implements a simple calculator

Recommend

Detailed explanation of the difference between flex and inline-flex in CSS

inline-flex is the same as inline-block. It is a ...

Tutorial diagram of installing zabbix2.4 under centos6.5

The fixed IP address of the centos-DVD1 version s...

WeChat applet + ECharts to achieve dynamic refresh process record

Preface Recently I encountered a requirement, whi...

A practical record of troubleshooting a surge in Redis connections in Docker

On Saturday, the redis server on the production s...

Where is the project location deployed by IntelliJ IDEA using Tomcat?

After IntelliJ IDEA deploys a Javaweb project usi...

Docker implements re-tagging and deleting the image of the original tag

The docker image id is unique and can physically ...

What is COLLATE in MYSQL?

Preface Execute the show create table <tablena...

How to use mysql to complete the data generation in excel

Excel is the most commonly used tool for data ana...

Navicat cannot create function solution sharing

The first time I wrote a MySQL FUNCTION, I kept g...

Teach you how to quickly enable self-monitoring of Apache SkyWalking

1. Enable Prometheus telemetry data By default, t...

Detailed explanation of Docker container network port configuration process

Exposing network ports In fact, there are two par...

Analysis of the methods of visual structure layout design for children's websites

1. Warm and gentle Related address: http://www.web...

VMware Workstation 14 Pro installation and activation graphic tutorial

This article shares the installation and activati...

How to use the VS2022 remote debugging tool

Sometimes you need to debug remotely in a server ...