Too many connections for neutron-db-manage [MySQL]

Updated on December 6, 2022

While finalizing the installation of neutron on controller node, the operation to populate the database failed with Too many connections for neutron-db-manage. Below is the complete error:

# su -s /bin/bash neutron -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head"
Traceback (most recent call last):
File "/usr/bin/neutron-db-manage", line 10, in <module>
sys.exit(main())
File "/usr/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 657, in main
return_val |= bool(CONF.command.func(config, CONF.command.name))
File "/usr/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 179, in do_upgrade
run_sanity_checks(config, revision)
File "/usr/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 641, in run_sanity_checks
script_dir.run_env()

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1040, u'Too many connections') (Background on this error at: http://sqlalche.me/e/e3q8)

Fix Too many connections for neutron-db-manage

Solution: Generally, the error is due to too many simultaneous connections (means all available connections are in use by other clients) or there might be old connections (sleeping process) that are not allowing new connections to get in.

You need to increase the value of these parameters in your mysql configurations. specifically max_connections to a larger value.

Open the /etc/my.cnf file and set the below parameters

# vim /etc/my.cnf

max_connections=5000
max_allowed_packet=256M
wait_timeout=180
interactive_timeout=200

Restart the MySQL service

# systemctl restart mariadb

Now the command to populate the database works without fail

# su -s /bin/bash neutron -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head"

Was this article helpful?

Related Articles

Leave a Comment