User Error in connection to db Mysql

User Error in connection to db Mysql

jalbojalbo Posts: 6Questions: 2Answers: 1

I have this error SQLSTATE[HY000] [1045] Access denied for user c1234_x@localhost
My code to connection is:
$sql_details = array(
'user' => 'c1234_xyz',
'pass' => 'gatorei',
'db' => 'c1234_xyz',
'host' => 'localhost',
);
// user and db have a same name.
This data is to server in the cloud (not local ).

Plis, any help is wellcome!
Thanks.

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    The error says c1234_x@localhost, but the array has c1234_xyz. Is that just an error in showing the text here?

    Either way, it suggests that your user name or password is invalid.

    Allan

  • jalbojalbo Posts: 6Questions: 2Answers: 1

    Hi Allan. Thanks for answering. There is an error in my transcript. The correct one is: "I have this error SQLSTATE [HY000] [1045] Access denied for user c1234_xyz '@ localhost".
    The username and password are correct. I have used them from another page and they work without error.
    Please, do you have another suggestion? Thanks a lot!

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    SQLSTATE [HY000] [1045] Access denied for user

    There are some options to look at in this SO thread. The problem is with credentials or other server configuration issue.

    Kevin

  • jalbojalbo Posts: 6Questions: 2Answers: 1

    Thanks!
    $sql_details = array(...,'host' => 'localhost');
    The server is not local (like xamp or wamp). The server is in the cloud. But this server say the value "host" is "localhost" . I use that value with other tools to connect to the database. Do I have to use another value?
    Thanks!

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Yep, you need to give the connection details to the database you wish to connect with!

    Colin

  • Tracy LoganTracy Logan Posts: 5Questions: 2Answers: 0

    Not sure this page is the best place to report this issue -- but since my search for previous reports brought me here, it seems reasonable to put it where other potential reporters might find it.

    Two of the Server-Side Processing example pages on the DataTables Live server have the same issue @jalbo had:

    live.datatables.net/examples/server_side/simple.html and
    live.datatables.net/examples/data_sources/server_side.html both make an AJAX call to live.datatables.net/examples/server_side/scripts/server_processing.php, which is currently returning this error:

    An error occurred while connecting to the database. The error reported by the server was: SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: NO)

    FYI & FWIW, the equivalent non-Live script (datatables.net/examples/server_side/scripts/server_processing.php) works properly when called by the equivalent non-Live SSP pages, datatables.net/examples/server_side/simple.html and datatables.net/examples/data_sources/server_side.html

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Those URLs for the live.datatables.net site aren't quite right. You could use the links from this page as the basis for a server-side processing example on the live site.

    Allan

Sign In or Register to comment.