If linux OS, suggest installing MySQLTuner ... a perl script ... and run it with superuser creds for the DB server. It will look at config for MySQL/MariaDB and stats/usage of DB server. Makes recommendations for tweaking config of DB server. Default for max_allowed_connections is 151 ...
'SoS', Ken