AdyAlex Posted January 25, 2018 Share Posted January 25, 2018 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 14Server 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 Apache Web Server Version 2.4.25 PHP Script Language Version 5.6.30 & 7.1.1 MySQL Database Version 5.7.17 phpMyAdmin Database Manager Version 4.6.6 Thank you db.class.php db.php Link to comment Share on other sites More sharing options...
requinix Posted January 26, 2018 Share Posted January 26, 2018 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.