Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
few day back my hosting server was goes down. so all my website stop working,i am usig cpanel for setting password and privileges to the user.
the i have changd mysql username and password and also set all privilleges to that user asd also set new passwrod to my websites's config file but still not working website . i am damn sure about my user name and password i have entered is correct

while access it on browser it gives me error .

What I have tried:

PHP
conn.php

require(MAIN_PATH.'_class/dbclass.php');
	require_once(MAIN_PATH."functions/function.php");
	$database='srijanip_demoor';
	$user='srijanip_demoor';
	$pass='pass';
	
	$host='demoor.srijani.in';
	

	define("DB_HOST", "$host");
	define("DB_NAME", "$database");
	define("DB_USER", "$user");
	define("DB_PWD", "$pass");


dbclass.php
   //_________define class_________________________// 
	
	class dbclass {	
		var $CONN;
		function dbclass() { //constructor
			$conn = mysql_connect(DB_HOST,DB_USER,DB_PWD,DB_NAME) or die('Could not connect: ' . mysql_error());
			$db = mysql_select_db(DB_NAME); 
			if(!$conn) 
				{	$this->error("Connection attempt failed");		}
			if(!mysql_select_db(DB_NAME)) 
				{	$this->error("Database Selection failed");		}
			$this->CONN = $conn;
			return true;
		}


		//_____________close connection____________//
		function close(){
			$conn = mysql_connect(DB_HOST,DB_USER,DB_PWD,DB_NAME) or  die('Could not connect: ' . mysql_error());
			$db = mysql_select_db(DB_NAME); 
			$conn = $this->CONN ;
			$close = mysql_close($conn);
			if(!$close){
			  $this->error("Close Connection Failed");	}
			return true;
		}
Posted
Updated 24-Sep-16 5:35am
v6
Comments
Mehdi Gholam 24-Sep-16 2:14am    
Contact your hosting service and make sure they have not disabled you.
SrijaniDev 24-Sep-16 2:18am    
but on the same server few websites are working fine

1 solution

The error message is explicit: "access denied for user ..." which means as far as MySql is concerned the user name and password combination you have supplied is not valid for that specific database.
If you have double and treble checked your username / password combination and the privilege level they require, and tried setting up a "dummy" user with the "right" access and that works, then the only solution is to talk to your web hosting company as there is nothing you can do from "outside" to change the situation. Certainly, there is nothing we can do - we can't even check your username / password / access combination!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900