Failed to connect to mysql database when Yii is in high concurrency.

Source: Internet
Author: User
Failed to connect to mysql database when Yii is in high concurrency. Explanation: PHPFatalerror: Failed: SQLSTATE [HY000] [2003] Cantconne failed to connect to mysql database when Yii is in high concurrency. Explanation
PHP Fatal error: Uncaught exception 'cdbexception' with message 'cdbconnection failed to open the DB connection: SQLSTATE [HY000] [2003] Can't connect to MySQL server on '***. ***. ***. ** '(4)' in/**/framework/db/CDbConnection. php 348

The error message is as follows. After the development and testing are completed, all functions are normal, but after the function is launched, 500 of the concurrency peak occurs. Very strange. For help.

------ Solution --------------------
By default, the Yii Framework CDbConnection sets 'executepart' => true, so that PDO-mysql connects to the database through persistent connections. When the concurrency is higher, the number of connections is maintained too much. The new connection fails. I guess so!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.