Jump to content

Warning: mysql_connect()


AdyAlex

Recommended Posts

Hi all

I recive this error when i tray to connect with the user and password:

 

Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO) in C:\AppServ\www\IMS\db\db.class.php on line 14
Server connection not possible.

 

This is my code:

 

class DB

  {
    var $defaultDebug = false;
    var $mtStart;
    var $nbQueries;
    var $lastResult;
    function DB($base, $server, $user, $pass)
    {
      $this->mtStart    = $this->getMicroTime();
      $this->nbQueries  = 0;
      $this->lastResult = NULL;
      mysql_connect($server, $user, $pass) or die('Server connexion not possible.');
      mysql_select_db($base)               or die('Database connexion not possible.');
 
I have :
AppServ Open Project - 8.6.0 for Windows 

 

db.class.php

db.php

Link to comment
Share on other sites

As the error message implies, root without a password is not allowed to connect.

 

Set up a normal non-root user with the permissions you need (probably SELECT+INSERT+UPDATE) on the database(s) it needs access to and have your script connect with that.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.