Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001011

Re: [PHP-DB] Connecting to MySQL Server with a Username and password??? (in Windows) From: Joey Garcia (jgarcia <email protected>)
Date: 01/09/01

Thanks for the suggestions everyone, as it turns out I had a couple of
problems, Johannes helped me the most with his suggestion below. Believe it
or not but the error was caused by me not having the mysqld started, that's
why I couldn't even connect, also there may have been a problem with my
password because I had a "-" in it because I think it would get confused
when I tried to login like this mysql -ujoey -p lmco-php, or maybe not?

Thanks again!

try this:
UPDATE user SET Password=PASSWORD('lmco-php') WHERE user='joey';
This encrypts the pswd somehow, but really no idea if this is the prob.

"Joey Garcia" <jgarcia <email protected>> wrote in message
news:93cnfp$r9h$1 <email protected>
> I know this sounds trivial but I usually develop on my home machine
without
> using a username and password but now I am teaching a class on PHP, so I
> added my UserID and Password to MySQL's user table and when I try to
connect
> I get the following error (I was trying to do an Insert, but I couldn't
even
> connect).
>
> Warning: MySQL Connection Failed: Access denied for user: 'joey <email protected>'
> (Using password: YES) in c:\program files\apache
> group\apache\htdocs\class\inserttest3.php on line 60
>
>
>
> Here is the results of my addition in the user table, I basically said "Y"
> to all priveldges.
>
> Any suggestions? Is it because I am already logged in as another user
when
> I use a web API? I can get in when I don't specify a Username or
Password,
> I guess it uses some default? (webuser?)
>
> Here is the code I am using.
>
> file://Initalize the variables to be used
> $user="joey";
> $pass="lmco-php";
> $host="localhost";
> $sql="Insert into lmco (fname,lname,age) values ('$fn','$ln',$age)";
> file://Start connection
> $conn=mysql_connect($host,$user,$pass) or die("Couldn't connect to
server");
> file://Select database
> $db=mysql_select_db("PHPClass, $conn") or die("Couldn't select database");
> file://Exeute SQL Query and get result
> $result=mysql_query($sql,$conn) or die("Couldn't execute query");
>
>
>

----------------------------------------------------------------------------

----

> > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe <email protected> > For additional commands, e-mail: php-db-help <email protected> > To contact the list administrators, e-mail: php-list-admin <email protected> >

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>