[thelist] mysql - old_password - persistent connection

Bob Meetin bobm at dottedi.biz
Tue Nov 18 16:19:04 CST 2008


I think I'm running into a problem with persistent connection dropping 
losing old_passwords = 'OFF'.  If I run any of the following queries 
from within mysql they work fine:

1) mysql> set old_passwords = 'OFF';select * from jos_users where 
username = 'some_username';
2) mysql> set old_passwords = 'OFF';select * from jos_users where 
username='some_username' AND password=PASSWORD('some_password');
3) mysql> select * from jos_users where username='some_username' AND 
password = (select password('some_password'));

However when I run them from within PHP, the first is fine, but the 
second and third fail:

1) $query = "set old_passwords = 'OFF';select * from jos_users where 
username = '$username'";
2) $query = "set old_passwords = 'OFF';select * from jos_users where 
username='$username' AND password=PASSWORD('$password')";
3) $query = "set old_passwords = 'OFF';select * from jos_users where 
username='$username' AND password = (select password('$password'))";

 From the mysql prompt if I run:

mysql> set old_passwords = 'OFF';
mysql> select * from jos_users where username='some_username' AND 
password=PASSWORD('some_password');

It works fine, however if I wait 10-15 seconds it fails, indicating that 
mysql has lost connection.  Is there another way I can do this to keep 
it honest?



More information about the thelist mailing list