Lets say I have a VPS with 512 MB guaranteed RAM (CPU is shared equally with all the VPSs on the host box, roughly 18, and its a Dual Xeon).

Whats a safe number to set the max_connections limit to for MySQL without running the risk of allowing the server to be overloaded?

I had it at 100 (I know that was a bit low), then whenever I tried to use certain programs, e.g. PHPbb, I got an error message saying:

Warning: mysql_connect(): Too many connections phpBB : Critical Error

Could not connect to the database

So I raised it to 350, and it was fine for a few days, but now the error messages are starting to come back.

Im in the process of trying to identify which programs are putting such a strain on things, but until then, whats an ok number to set the max_connections to?

Thanks in advance for all your help guys.

P.S. This VPS has very few active websites (less than 8).
Thanks again.