Bug #81884 Connectoin failed : Access denied
Submitted: 16 Jun 2016 11:54 Modified: 16 Jun 2016 21:28
Reporter: Kevin KIM Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Connection Handling Severity:S2 (Serious)
Version:5.5.49 OS:Red Hat
Assigned to: CPU Architecture:Any

[16 Jun 2016 11:54] Kevin KIM
Description:
Maybe this is not a bug but a problem.

Using web service when my colleague sends a lot of requests to my server, the following error occurs at about 10% frequency.

SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database ‘mydb_1.0.0104'

How to repeat:
The following is the my colleague’s request. The function add_data() is called 50,000 times.

while(1) {
  if (end) break;

  add_data();
}

But if sleep() is added as like following, this error does not occur.

while(1) {
  if (end) break;

  add_data();
  sleep(2); // 2ms
}

My server systems are Red Hat Enterprise Server 6.5 + MySQL(5.5.49) + Apache(2.2.31) + PHP(5.6.21).
If the request comes, trying to connect database to add data using PDO as like followings.
And the upper error occurs.

class database extends PDO {
  protected $dbconn;

  public function __contstruct($iniFile) {
    $dbName = “mydb_1.0.0104”;
    $dbUser;
    $dbPass;

    getAccountPassword($iniFile, $dbUser, $dbPass);
    
    $dsn = “mysql:host=127.0.0.1;dbname={$dbName};charset=utf8”;

    try {
      $this->dbconn = parent::__construct($dsn, $dbUser, $dbPass);
    } catch (PDOException $e) {
      write_log($e->getMessage());
    }
  }
}

I thought “max_connections” should be increased.
But if this is the reason, the error code will be 1040 not 1044.

Please let me know what I made mistake.

Thanks
[16 Jun 2016 21:28] MySQL Verification Team
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/

Thank you for your interest in MySQL.