mysql_real_connect: Too many connections

That's not FreeBSD's doing but the MySQL server you use. The solution depends on the situation.

You could increase the amount of accepted connections using the max_connections variable, but that's only a liable option if the requested connections are actually all legitimate. See this web page for more information on how to do this.

Keep in mind that this might not fix the problem. For example; if some website got overrun which made it request too many connections then obviously increasing this amount on MySQL won't make the cause of the problem go away. In that case you'd need to tune Apache, not MySQL.

And finally in some cases you can utilize a proxy of some sort to "share" connections. But that heavily depends on the situation and you're not exactly giving us much information to go on.
 
Back
Top