jimbona27
asked on
php help with mysql_connect
Hi ee,
I have this line of code to connect to a remote database but I get the following error:
Warning: mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter than expected in C:\wamp\www\conn.php on line 15
Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using old authentication in C:\wamp\www\conn.php on line 15
Could not connect: mysqlnd cannot connect to MySQL 4.1+ using old authentication
can someone please advise how I can resolve this issue?
Thanks,
I have this line of code to connect to a remote database but I get the following error:
Warning: mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter than expected in C:\wamp\www\conn.php on line 15
Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using old authentication in C:\wamp\www\conn.php on line 15
Could not connect: mysqlnd cannot connect to MySQL 4.1+ using old authentication
can someone please advise how I can resolve this issue?
Thanks,
$con = mysql_connect('x.x.x.x', $strDatabaseUser, $strDatabasePassword);
Create a new user ID and password for the database and retry.
ASKER
can you show me how to do that as I only have dbforge to manipulate the database. im used to phpmyadmin and ms sql studio..???
thanks,
thanks,
ASKER
i've tried this:
grant usage on database_name.* to user_name@localhost IDENTIFIED BY ’somepassword’ WITH GRANT OPTION;
and not I get
grant usage on database_name.* to user_name@localhost IDENTIFIED BY ’somepassword’ WITH GRANT OPTION;
and not I get
Access denied for user 'name@x.x.x.x' (using password: YES)
ASKER
i've noticed the IP address stated in the error is different to the IP I set within the mysql_connect command.
please note: I am behind a VPN client although this is running and DBForge can connect to the IP address im using in the connect command..
please note: I am behind a VPN client although this is running and DBForge can connect to the IP address im using in the connect command..
Hmm, DBForge will have a security manager that will give you user names and access rights for each database.
ASKER
its empty...?
ASKER
any ideas?
gtrab.GIF
gtrab.GIF
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i've spoken to the people that host the database and they are using PHP 5.1 whereas we are using 5.3
any suggestions? can I use a different method to connect or something?
Thanks,
this is the error:
Warning: mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter than expected in C:\wamp\www\try.php on line 10
Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using old authentication in C:\wamp\www\try.php on line 10
Unable to select database
any suggestions? can I use a different method to connect or something?
Thanks,
this is the error:
Warning: mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter than expected in C:\wamp\www\try.php on line 10
Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using old authentication in C:\wamp\www\try.php on line 10
Unable to select database
<?php
class DB {
var $conn;
function __construct() {
$user = "xxx";
$password = "xxx";
$db = "xxx";
$this->conn = mysql_connect('xxx', $user, $password);
@mysql_select_db($db) or die("Unable to select database");
}
function getConn() {
return $this->conn;
}
}
$db = new DB();
;?>
ASKER
i've tested the code on the actual server and it works but for me using WAMP (which is PHP 5.3) it fails..
This is generally a fairly simple problem, the password in the database is using the older short hash method instead of the newer method.
To fix these reset the password
SET PASSWORD FOR 'user'@'localhost' = PASSWORD(newpassword');
This is what actually causing you this problem:
http://www.bitshop.com/Blogs/tabid/95/EntryId/67/PHP-mysqlnd-cannot-connect-to-MySQL-4-1-using-old-authentication.aspx
To fix these reset the password
SET PASSWORD FOR 'user'@'localhost' = PASSWORD(newpassword');
This is what actually causing you this problem:
http://www.bitshop.com/Blogs/tabid/95/EntryId/67/PHP-mysqlnd-cannot-connect-to-MySQL-4-1-using-old-authentication.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i think you r using old version
Thanks
Mehul Panchal
Thanks
Mehul Panchal