Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect frm cmd line but not via php to mysql database.

Status
Not open for further replies.

tommytx

Programmer
Nov 27, 2002
28
US
I have installed a new issue of mysql 4.1 and am able to build and control a database via the cmd line. However I can't connect using php. My system is windows XP.
My php commands require a pw and user name and I don't have a user name. I tried to connect to the root with php and could not. Below is the results and the php program I used. Any advice you could provide to this lost soul would be greatly appreciated.

Message when trying to connect to apache with mysqltest.php
***********************************************************

Using no password for root.
***************************
Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO) in C:\Program Files\Apache Group\Apache2\htdocs\mysqltest.php on line 7
Sorry - unable to connect to MySQL

Using the password for the root.
********************************
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\Program Files\Apache Group\Apache2\htdocs\mysqltest.php on line 7
Sorry - unable to connect to MySQL


The below is the progmam I used.
********************************
<?php
$connection = mysql_connect ( "localhost", "root", "") or die ( "Sorry - unable to connect to MySQL" );
echo( "Congratulations - you connected to MySQL" );
?>

How do I get a user name to use with my password.
I can get in at the cmd line using root and the pw but not with php.
 
I have since gone into the root and granted full privileges to tommytx@localhost with password of tcx123.
Now I can log onto the root with user tommytx and pw tcx123, however the problem continues that even though I use the user name and password, I can' connect to the data base via php. See the php program above.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top