problem in connection with db

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

problem in connection with db

Post by itsmani1 »

connection.php code

Code: Select all

<?php 
/*
	$host="localhost";
	$dbUser="videocli_vc4s";
	$dbPasw="vc4s";
	$dbName="videocli_vc4s";
	//$dbLink="";
	$dbLink=mysql_connect($host, $dbUser, $dbPasw) or die("Can't connect to db ".mysql_error());
*/

$dbh=mysql_connect ("localhost", "videocli_mike", "mike") or die (mysql_error());
mysql_select_db ("videocli_vc4s");

//	mysql_select_db($dbName, $dbLink) or die("Can't use db ".mysql_error());

//Save traffic history
function save_traffic_log($storeid)
	{
		$ref_site = $_SERVER['HTTP_REFERER'];
		//echo $ref_by;
		$ref_domain = str_replace("http://", "", $ref_site);
		$firstslash = strpos($ref_domain, "/");
		$ref_domain = substr($ref_domain, 0, $firstslash);
		$host = $_SERVER['REMOTE_ADDR'];
		$time = time();
		
		$save_log = @mysql_query("INSERT INTO `statistics` ( `store_id`, `store_type` , `ref_site` , `ref_domain` , `host` , `time` ) VALUES ('$storeid', 'clip', '$ref_site', '$ref_domain', '$host', '$time')");
	}

?>
Error:

Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in /home/videocli/public_html/connection.php on line 11
Client does not support authentication protocol requested by server; consider upgrading MySQL client
jamiel
Forum Contributor
Posts: 276
Joined: Wed Feb 22, 2006 5:17 am
Location: London, United Kingdom

Post by jamiel »

In MySQL do this ...

Code: Select all

UPDATE mysql.user SET Password = OLD_PASSWORD('yourpasswordhere') WHERE user = 'yourusernamehere';
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

Code: Select all

UPDATE mysql.user SET PASSWORD = OLD_PASSWORD( 'mike' ) WHERE user = 'videocli_vc4s';
Result :
Affected rows: 0 (Query took 0.0003 sec)
jamiel
Forum Contributor
Posts: 276
Joined: Wed Feb 22, 2006 5:17 am
Location: London, United Kingdom

Post by jamiel »

Code: Select all

SELECT * FROM mysql.user WHERE User = 'videocli_vc4s'
Does that return a row?
jamiel
Forum Contributor
Posts: 276
Joined: Wed Feb 22, 2006 5:17 am
Location: London, United Kingdom

Post by jamiel »

If so then do this ...

Code: Select all

FLUSH PRIVILEGES;
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

after doing flush :

got this error :


Warning: mysql_connect(): Access denied for user 'videocli_vc4s'@'localhost' (using password: NO) in /home/videocli/public_html/connection.php on line 11
I cannot connect to the database because: Access denied for user 'videocli_vc4s'@'localhost' (using password: NO)
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

jamiel wrote:

Code: Select all

SELECT * FROM mysql.user WHERE User = 'videocli_vc4s'
Does that return a row?

return empty set
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

tried this :


mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
-> WHERE Host = 'some_host' AND User = 'some_user';
Result : Query OK one row effected


mysql> FLUSH PRIVILEGES;
Result : Query OK 0 row effected
jamiel
Forum Contributor
Posts: 276
Joined: Wed Feb 22, 2006 5:17 am
Location: London, United Kingdom

Post by jamiel »

Code: Select all

GRANT ALL PRIVILEGES ON videocli_vc4s TO videocli_vc4s@localhost IDENTIFIED BY 'mike';
UPDATE mysql.user SET PASSWORD = OLD_PASSWORD('mike') WHERE user = 'videocli_vc4s';
FLUSH PRIVILEGES;
If that fails upgrade your MySQL Cient to solve your original error the correct way.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

[SOLVED]

Post by itsmani1 »

[SOLVED]
Post Reply