Updating the MySQL max connections setting
The MySQL database will start giving too many connection errors when all the available connections are in use by other clients. In this recipe, you will learn how to update the MySQL cartridge max connections setting.
Getting ready
To complete this recipe, you will need an application with a MySQL cartridge. Please refer to the Adding a MySQL cartridge to your application recipe of this chapter to learn how to install the MySQL cartridge.
How to do it…
Follow these steps to update the MySQL max connection setting:
To set the maximum connections to
200
, open a command-line terminal, and run the following command:$ rhc env-set OPENSHIFT_MYSQL_MAX_CONNECTIONS=200 --app myapp
After setting the environment variable, you have to restart the MySQL cartridge for changes to take effect using the following command:
$ rhc cartridge-restart mysql --app myapp
How it works…
The number of connections supported by the MySQL database is controlled by the max_connections...