How to set the number of mysql connections (Too connections) and mysqlconnections

Source: Internet
Author: User

How to set the number of mysql connections (Too connections) and mysqlconnections

When using mysql, it is found that the number of connections has exceeded ~~~~

[Root @ linux-node1 ~] # Mysql-u glance-h 192.168.1.17-p

Enter password:

ERROR 1040 (08004): Too connector connections

Solution: this is also the practice of modifying the number of mysql connections under centos7:

1) temporary modification

MariaDB [(none)]> show variables like "max_connections ";
+ ----------------- + ------- +
| Variable_name | Value |
+ ----------------- + ------- +
| Max_connections | 214 |
+ ----------------- + ------- +
1 row in set (0.00 sec)
MariaDB [(none)]> set GLOBAL max_connections = 1000;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show variables like "max_connections ";
+ ----------------- + ------- +
| Variable_name | Value |
+ ----------------- + ------- +
| Max_connections | 1000 |
+ ----------------- + ------- +
1 row in set (0.00 sec)

2) Permanent modification:

Configure/etc/my. cnf
[Mysqld] Add a new line with the following parameters:
Max_connections = 1000
Restart the mariadb service and check the maximum number of connections of the mariadb database again. The maximum number of connections is 214, not 1000.
MariaDB [(none)]> show variables like 'max _ connections ';
+ ----------------- + ------- +
| Variable_name | Value |
+ ----------------- + ------- +
| Max_connections | 214 |
+ ----------------- + ------- +
This is because mariadb has the default limit on the number of opened files. You can increase the number of opened files by configuring/usr/lib/systemd/system/mariadb. service.

Configure/usr/lib/systemd/system/mariadb. service

[Service] Add the following parameters:
Maid = 10000
LimitNPROC = 10000

Reload the system service and restart the mariadb service.

Systemctl -- system daemon-reload
Systemctl restart mariadb. service

Check the maximum number of connections of the mariadb database again. The maximum number of connections is already 1000.

MariaDB [(none)]> show variables like 'max _ connections ';
+ ----------------- + ------- +
| Variable_name | Value |
+ ----------------- + ------- +
| Max_connections | 1000 |
+ ----------------- + ------- +

The above operation method for setting the number of mysql connections (Too connections) is all the content that I have shared with you. I hope to give you a reference and support for the customer's house.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.