Re: Connecting to MySQL Server with a Username and password??? (in Windows)
| From: | Joey Garcia | Date: | Tue, 09 Jan 2001 18:05:15 +0000 |
| Subject: | Re: Connecting to MySQL Server with a Username and password??? (in Windows) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-5757@lists.php.net to get a copy of this message | ||
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@mobilize.com> wrote in message
news:93cnfp$r9h$1@toye.p.sourceforge.net...
> 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@localhost'
> (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@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>