php, mysql - Too many connections to database error

前端 未结 6 1551
南方客
南方客 2020-12-03 10:40

Good day to all. I have an odd error. I have created a chat that works like this:

  • questions/answers are inserted into a db
  • every 2 seconds an ajax re
6条回答
  •  一向
    一向 (楼主)
    2020-12-03 11:29

    There are a bunch of different reasons for the "Too Many Connections" error.

    Check out this FAQ page on MySQL.com: http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html

    Check your my.cnf file for "max_connections". If none exist try:

    [mysqld]
    set-variable=max_connections=250
    

    However the default is 151, so you should be okay.

    If you are on a shared host, it might be that other users are taking up too many connections.

    Other problems to look out for is the use of persistent connections and running out of diskspace.

提交回复
热议问题