Jump to content

Warning: mysql_connect()

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 




Share this post

Link to post
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.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.