Get the App
SLTechnology News&Howtos  ›  Servers  › 

How linux modifies the maximum number of connections for mysql

Shulou Source: shulou.com Published: 2022-05-31 10:41:30 09月30日 Update

This article mainly introduces linux how to modify the maximum number of connections of mysql related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this linux how to modify the maximum number of connections of mysql will have a harvest, let's take a look.

Methods: 1, use "set GLOBAL max_connections= links" to temporarily modify the maximum number of connections; 2, use "vim / etc/my.cnf1" to modify the content of "max_connections", save and restart the mysql service to permanently modify the maximum number of connections.

The operating environment of this tutorial: linux7.3 system, mysql8.0.22 version, Dell G3 computer.

How to modify the maximum number of connections of mysql by linux method 1: modify temporarily

Client login:

Mysql-uroot-p

Set the new maximum number of connections to 1000:

Mysql > set GLOBAL max_connections=1000

Displays the currently running Query:

Mysql > show processlist

Show current status:

Mysql > show status

Exit the client:

Mysql > exit

View the current maximum number of connections:

Mysqladmin-uroot-p variables

This method treats the symptoms rather than the root cause, and the maximum number of connections after restarting the service is still 100. This method is used to urgently expand the maximum number of connections and is not a long-term solution.

Method 2: permanently modify

View profile location

/ usr/bin/mysql-- verbose-- help | grep-A 1 'Default optioDefault options are read from the following files in the given order:/etc/my.cnf / etc/mysql/my.cnf / usr/etc/my.cnf ~ / .my.cnf

The server reads the / etc/my.cnf file first, reads / etc/mysql/my.cnf if it does not exist, and then reads / usr/etc/my.cnf, ~ / .my.cnf

Look for the configuration file under the root path:

Find /-name my.cnf result: / etc/my.cnf

Configuration

Vim / etc/my.cnf

Edit my.cnf to add to [mysqld]:

Max_connections=1000

Restart the service

Service mysqld restart

View the number of connections

This is the end of the article mysql-u root-pshow variables like 'max_connections'; on "how linux modifies the maximum number of connections in mysql". Thank you for reading! I believe you all have a certain understanding of "how linux modifies the maximum number of connections of mysql". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Maximum method service content file knowledge configuration client client article permanent long-term temporary cure long-term solution value location method simple operation tutorial article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Xiaomi NVidia Apple Linux