Cannot connect to mysql (install separately)

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Cannot connect to mysql (install separately)

Postby dlmaster » 25. November 2007 19:23

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...
dlmaster
 
Posts: 19
Joined: 12. November 2007 05:54

Postby LooseCannon » 26. November 2007 15:15

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.
User avatar
LooseCannon
 
Posts: 162
Joined: 18. September 2007 12:07
Location: Hampshire, UK

Getting worried

Postby dlmaster » 28. November 2007 14:23

I don't really get what it is saying... :oops: 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? :?
dlmaster
 
Posts: 19
Joined: 12. November 2007 05:54

Re: Cannot connect to mysql (install separately)

Postby LooseCannon » 04. December 2007 10:01

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. ;)
User avatar
LooseCannon
 
Posts: 162
Joined: 18. September 2007 12:07
Location: Hampshire, UK

Postby KallistaAEnvarou » 05. December 2007 00:03

What's your code?
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

Postby dlmaster » 05. December 2007 12:15

mysql_connect('localhost', 'root','ad', 'blo');

I haven't really got into the coding. I just type this line and it had the warning... :oops:
dlmaster
 
Posts: 19
Joined: 12. November 2007 05:54

Postby sari42 » 05. December 2007 12:59

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
sari42
 
Posts: 800
Joined: 27. November 2005 18:28

Postby KallistaAEnvarou » 05. December 2007 19:06

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
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

Postby dlmaster » 06. December 2007 14:05

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?
dlmaster
 
Posts: 19
Joined: 12. November 2007 05:54

Postby dlmaster » 06. December 2007 14:24

grant usage on *.* to username@localhost identified by pwd;

FLUSH PRIVILEGES;

Tried these in mysql command line... sigh... :(
dlmaster
 
Posts: 19
Joined: 12. November 2007 05:54

Postby dlmaster » 06. December 2007 17:18

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..
dlmaster
 
Posts: 19
Joined: 12. November 2007 05:54

Postby KallistaAEnvarou » 06. December 2007 21:45

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.
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

Postby dlmaster » 07. December 2007 06:17

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...
dlmaster
 
Posts: 19
Joined: 12. November 2007 05:54

Postby KallistaAEnvarou » 07. December 2007 16:45

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.
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

Postby dlmaster » 11. December 2007 18:38

Thank you... If I did not use phpmyAdmin, is it okay? Coz I only use XAMPP for the apache... :wink: But I really appreciate your reply. It could be useful when I need to use phpmyadmin later in other project. Thank you very much :)
dlmaster
 
Posts: 19
Joined: 12. November 2007 05:54


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 119 guests