MySQL Forums
Forum List  »  Performance

SQLSTATE[HY000] [1044] Access denied
Posted by: YOONTAE KIM
Date: June 16, 2016 07:55PM

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.0131’

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.0131”;
$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 that “max_connections” should be increased.
But if this is the reason, the error code will be 1040 not 1044.

Can anyone advise me what the problem is?
Thanks for any suggestions.

Options: ReplyQuote


Subject
Views
Written By
Posted
SQLSTATE[HY000] [1044] Access denied
10569
June 16, 2016 07:55PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.