Page 1 of 1
Cannot connect to mysql (install separately)
Posted:
25. November 2007 19:23
by dlmaster
I am using XAMPP version 1.4.9 and Eclipse 3.2.0. The web application I am trying to do require database. The problem is the mysql (version 5.0) is installed separately. Does anyone here knew how to connect to the mysql?
I've been getting this messages:
Warning: mysql_connect() [function.mysql-connect]: Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\xampp-win32-1.4.9\xampp\eclipse\workspace\PB\reg_form.php on line 8
Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp-win32-1.4.9\xampp\eclipse\workspace\PB\reg_form.php on line 9
Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in C:\xampp-win32-1.4.9\xampp\eclipse\workspace\PB\reg_form.php on line 9
Please help and thank you in advance...
Posted:
26. November 2007 15:15
by LooseCannon
You've spotted this other thread yet?
http://community.apachefriends.org/f/viewtopic.php?t=27434
I suggest sorting out the top issue first and see if the others remain thereafter.
Getting worried
Posted:
28. November 2007 14:23
by dlmaster
I don't really get what it is saying...
sigh... but then i manage to somehow get rid of that message without removing the coding (mysql_connect) but I am not sure whether it is solved because I need to shutdown the instance (mysql install separately). I suppose it means I didn't solve it correct?
Re: Cannot connect to mysql (install separately)
Posted:
04. December 2007 10:01
by LooseCannon
I gave a link to a thread, posted about the same time as yours, that I think answered this problem:
dlmaster wrote:...
Warning: mysql_connect() [function.mysql-connect]: Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\xampp-win32-1.4.9\xampp\eclipse\workspace\PB\reg_form.php on line 8
...
What I meant was, sort that out and see if other errors still happen.
However, if it now works, don't fix it.
Posted:
05. December 2007 00:03
by KallistaAEnvarou
What's your code?
Posted:
05. December 2007 12:15
by dlmaster
mysql_connect('localhost', 'root','ad', 'blo');
I haven't really got into the coding. I just type this line and it had the warning...
Posted:
05. December 2007 12:59
by sari42
first hit on google "Client does not support authentication protocol requested by server":
http://dev.mysql.com/doc/refman/5.0/en/old-client.html
Posted:
05. December 2007 19:06
by KallistaAEnvarou
Well, first, the fourth argument is supposed to be boolean $new_link. I know that 'blo' is considred true. Is that what you intended, or did you intend to have that be part of int $client_flags?
If the above suggestion doesn't work, see
php.net
Posted:
06. December 2007 14:05
by dlmaster
I have modified the code..
$conn = mysql_connect($hostname,$dbname,$dbuser,$dbpasww) or die ("Connection error: ".mysql_error());
echo("Connected");
Now the warning is :
Connection error: Access denied for user 'phblo'@'localhost' (using password: YES)
I already check with query browser and mysql command , the username and password use is correct. I have no more idea on why it still give me such warning... I wonder is it the configuration in eclipse is not correct... as the mysql is installed separately and not xampp... How do I enable the start mysql button in the eclipse?
Posted:
06. December 2007 14:24
by dlmaster
grant usage on *.* to username@localhost identified by pwd;
FLUSH PRIVILEGES;
Tried these in mysql command line... sigh...
Posted:
06. December 2007 17:18
by dlmaster
Well ... I hope I got it right....
This is what I do in the mysql command line
mysql>grant usage on *.* to username@localhost identified by pwd;
mysql>FLUSH PRIVILEGES;
but this did not work (alone)as it just allowed the localhost to access mysql (i hope the terms i used is correct), so i used what i had tried earlier together with this:
UPDATE mysql.user SET PASSWORD = OLD_PASSWORD('newpwd')
WHERE HOST = 'yourhost' AND USER = 'username';
FLUSH PRIVILEGES;
Actually I have tried this first but it did not work which is the alternative of the above update method:
mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
I suppose there is nothing wrong with the password but my username is wrong and I didn't know that. The above one, the update method is more reliable...in my opinion.
Anyhow thanks for the reply.. Thank you so much..
Posted:
06. December 2007 21:45
by KallistaAEnvarou
Have you tried to connect with the default account and password? Also, try mysql_connect($server,$user,$password), no other arguments and see if you get an error there.
Posted:
07. December 2007 06:17
by dlmaster
Actually I've never change the username and password... I use the update statement to update the same password and username.... I hope whatever problem it is, whatever i'm doing is correct...
Posted:
07. December 2007 16:45
by KallistaAEnvarou
Well, look in your xampp\phpMyAdmin\config.inc.php file for the username and password to phpMyAdmin and try that. Search for something like:
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
Try to connect with whatever you see in the acutal values using mysql_connect('localhost','root',''), if they're what you see.
If you don't get an error there, then you know there's definitely something's wrong with what you're doing; otherwise, something's probably going haywire on your machine.
Posted:
11. December 2007 18:38
by dlmaster
Thank you... If I did not use phpmyAdmin, is it okay? Coz I only use XAMPP for the apache...
But I really appreciate your reply. It could be useful when I need to use phpmyadmin later in other project. Thank you very much