Strange MySql connection problem

Hi folks,

i am facing a strange problem.

Access denied for user 'john'@'localhost' (using password: NO)

myproblem is, there are no user such as john at all in our company. i checked all my scripts and found no ware it is mentioned as john, then checked cpanel mysql databases and list of users. no ware john is mentioned.

who the heck is this john, i am banging head…

We are hosted our website on justhost. To make sure we are not connecting to any other local web servers in the company, i have even removed the local area cable.

Connection Script

/*** mysql hostname ***/
$hostname = 'localhost';

/*** mysql username ***/
$username = 'xxxco';

/*** mysql password ***/
$password = '123456';

try {
    $db = new PDO("mysql:host=$hostname;dbname=xxxco_visa", $username, $password);
    /*** echo a message saying we have connected ***/
    //echo 'Connected to database'; 
       
    // Throw exceptions on errors
    $db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
    
    // Use assoc arrays by default
    $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE,PDO::FETCH_ASSOC);        

    array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET time_zone = \'+03:00\'')    ;
}catch(PDOException $e){
    echo $e->getMessage();
}
?>

Server information

*> Server: Localhost via UNIX socket

Software: Percona ServerSoftware version: 5.5.40-36.1-log - Percona Server (GPL), Release 36.1, Revision 707Protocol version: 10
User: xxxco@localhost
Server charset: UTF-8 Unicode (utf8)*

Also if i rung the connection script directly then no any error. just blank. mean ok.

http://visa.xxxx.com/includes/pdo_connection.php

I can use MySQL with names that are not defined as user-names, but cannot access databases with that name. This allows me to perform operations that do not require privileges, such as performin a SELECT statement without a table/view.
For example:

select 1+2;

So couldn’t it be that someone was trying to test something? Maybe, it’s not in a script… or, as @Amit_Yaron suggests, someone querying the database… without really querying at all (a SELECT that doesn’t call any tables)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.