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 Quote Link to comment https://forums.phpfreaks.com/topic/306328-warning-mysql_connect/ 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. Quote Link to comment https://forums.phpfreaks.com/topic/306328-warning-mysql_connect/#findComment-1555770 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.