Which script is trying to login to MySQL

wattie

Verified User
Joined
May 31, 2008
Messages
1,082
Location
Bulgaria
In the MySQL error log I get lots of these:

[Warning] Access denied for user ''@'localhost' (using password: NO)
It's coming from localhost. It does not show which script is trying to login. How can I find out?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,252
Location
GMT +7.00
Hello,

I guess only through a manual scan... search

If 'user' is an unique name (masked here) then you could probably start with grep and search mysql_connect through the files of the user.

And/or compare time of the logged lines against GET/POST requests from Apache/Nginx logs, and crontasks...
 

wattie

Verified User
Joined
May 31, 2008
Messages
1,082
Location
Bulgaria
Sadly it's not masked. If it was a real username, I would know. It's trying to do anonymous login (without user and pass) :(
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,252
Location
GMT +7.00
Got probably similar error in error.log of Apache:

Code:
AH01071: Got error 'PHP message: PHP Warning:  mysql_real_escape_string(): Access denied for user ''@'localhost' (using password: NO)
so you might want to use grep and search the error through apache webserver error logs.

In my case the error introduced after migrating to PHP 7.2.
 
Top