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!