2

I tried to access the index page of my website: index.php, via this link: localhost:80/web/index.php. This brought me to a blank page on chrome that shows the error result:

Warning: Declaration of SugarDateTime::setTime($hour, $minute, $sec = 0) should be compatible with DateTime::setTime($hour, $minute, $second = NULL, $microseconds = NULL) in C:\xampp\htdocs\uat\include\SugarDateTime.php on line 692 Could not connect to the database. Please refer to simplecrm.log for details.

I checked the "simplecrm.log" file, it showed me the error:

Could not connect to DB server localhost as jobportal. port : Access denied for user 'jobportal'@'localhost' (using password: YES)

I have scoured the internet for answers, especially:

But these answers only show the root user, while my issue refers to the "jobportal" user. I did try the solutions given but I still can't solve this issue.

Here is the code in index.php:

include ('include/MVC/preDispatch.php');
$startTime = microtime(true);
require_once('include/entry.php');
ob_start();
require_once('include/MVC/SugarApp.php');
$app = new SugarApp();
$app->startSession();
$app->execute();
Denise
  • 153
  • 1
  • 6
  • what os you're on and what stack you're using?? – popeye Nov 30 '17 at 05:54
  • I'm using windows 7, and using xampp. I tried wampserver but it has the same error – Denise Nov 30 '17 at 06:31
  • Did you create a user account called `jobportal`? Did you give that new account access to the database you are using? Did you give that account the same password you are using in your code? – RiggsFolly Nov 30 '17 at 08:55
  • @RiggsFolly yes, already done that. This user isn't the root user. Do I have to edit anything in the config.inc.php file? – Denise Nov 30 '17 at 09:12
  • Not sure about XAMPP, but WAMPServer's phpMyAdmin throws a login screen that asks for a UserId and Password so you dont need to amend the `config.inc.php` file. You can use any valid UserId/Password pair to login to MySQL from phpMyAdmin. – RiggsFolly Nov 30 '17 at 22:13
  • It sounds like you have not created a `jobportal` user in MySQL or you are using a password in your code that does not match the password you set on the `jobportal` account. – RiggsFolly Nov 30 '17 at 22:15

2 Answers2

1

If you set your database password then write like

$db_name = 'dbname';
$db_pass = 'yourPasss';

Else 
$db_name = 'dbname';
$db_pass = ''; //empty
Sagor
  • 81
  • 1
  • 9
  • which file do I make these changes? – Denise Nov 30 '17 at 08:43
  • Errr `phpMyAdmin` does not have a password, its a PHP application. However a MySQl account does have a password – RiggsFolly Nov 30 '17 at 14:24
  • #Riggs I know. but i think this would help to understand easily. #Denise in your database connection. Like... mysqli_connect('host', 'user', 'pass', 'dbName'); – Sagor Dec 04 '17 at 07:23
0

Try granting all privilages on the database to user jobportal using the following SQL, like so:

GRANT ALL PRIVILEGES ON your_database.* TO 'jobportal'@'localhost' 
IDENTIFIED BY 'your_db_password';

After executing the above, execute the following:

FLUSH PRIVILEGES;
Adera
  • 27
  • 1
  • 7