MySQL in the process of use, found that the number of connections over ~ ~ ~
[Email protected] ~]# mysql-u glance-h 192.168.1.17-p
Enter Password:
ERROR 1040 (08004): Too Many connections
Workaround, which is also the practice of modifying the number of MySQL connections under Centos7:
1) temporarily modify
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 | | |
+-----------------+-------+
1 row in Set (0.00 sec)
2) Permanent modification:
Configure/ETC/MY.CNF
[Mysqld] Adds a new line with the following parameters:
max_connections=1000
Restart the MARIADB service to see the maximum number of connections for the MARIADB database again, and you can see that the maximum number of connections is 214, not the 1000 we set.
MariaDB [(None)]> show variables like ' max_connections ';
+-----------------+-------+
| variable_name | Value |
+-----------------+-------+
| max_connections | 214 |
+-----------------+-------+
This is because MARIADB has the default number of open files limit. You can adjust the number of open files by configuring/usr/lib/systemd/system/mariadb.service.
Configure/usr/lib/systemd/system/mariadb.service
Add two new lines with the following parameters:
limitnofile=10000
limitnproc=10000
Reload the system service and restart the MARIADB service
Systemctl--system daemon-reload
Systemctl Restart Mariadb.service
To see the maximum number of connections for the MARIADB database again, you can see that the maximum number of connections is 1000
MariaDB [(None)]> show variables like ' max_connections ';
+-----------------+-------+
| variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+
MySQL Connection number setup operation (Too many connections)