Code Comments
Programming Forum and web based access to our favorite programming groups.Hi
try $db =3D mysql_connect("localhost", "myuser","mypassword") - without =
it you are not submitting a password=20
Peter
> -----Original Message-----
> From: Christian Schlaefcke [mailto:cschlaefcke@wms-network.de]
> Sent: 24 September 2004 13:31
> To: php-db@lists.php.net
> Subject: [PHP-DB] Newbie Question - mysql_select_db fails with access
> denied.
>=20
>=20
> Hi Folks,
>=20
> I want to do something like the following:
> $db =3D mysql_connect("localhost", "myuser") or die("Connect failed : =
" .
> mysql_error());
>=20
> mysql_select_db("mydb",$db) or die("SELECT_DB failed : " . mysql_error
> ());
>=20
> $result =3D mysql_query("SELECT * FROM mytable", $db) or die("Query
> failed : " . mysql_error());
>=20
> The script does not proceed beyond the "mysql_select_db" line. I get
> this error:
> SELECT_DB failed: Access denied for user ''@'localhost' to database
> 'mydb'
>=20
> What happened to the user information. I have granted all neccessary
> rights to "myuser". But it seems that it=C2=B4s even not caring about =
the
> user.
>=20
> I have MySQL 4.1.4 and PHP 4.3.8-2.1 on a Fedore Core 2 System =
running.
>=20
> Thanks & Regards,
>=20
> Chris
>=20
> --=20
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20
Post Follow-up to this messageYou're right:
if you use mysql_connect("localhost", "root","");
you''ll get "acces denied for user root@localhost
if you use mysql_connect("localhost");
you'll get "Access denied for user @localhost"
I'll google for a while... but.. to solve YOUR problem, just use:
mysql_connect("localhost","user","");
Good luck!
On Fri, 24 Sep 2004 14:56:35 +0200, Christian Schlaefcke
<cschlaefcke@wms-network.de> wrote:
> I have chosen an empty password. I know that this is a security problem.
> I=B4m using it for testing at the moment only. I use it because there als=
o
> seems to be an issue with php connecting to mysql servers with verions >
> 4.1.
>=20
> When trying to connect with password I get this:
> Connect failed : Client does not support authentication protocol
> requested by server; consider upgrading MySQL client.
>=20
> Because I want to track down issue after issue and not anything at once
> I decided to find out why mysql_select_db fails first.
>=20
> What really makes me wonder in my tiny example is that the error message
> does not say something like:
>=20
> SELECT_DB failed: Access denied for user 'myuser'@'localhost' to
> database 'mydb'
>=20
> instead it says:
> SELECT_DB failed: Access denied for user ''@'localhost' to database
> 'mydb'
>=20
> So I think that the username is not interpreted at all. Why not?
>=20
> Regards,
>=20
> Chris
>=20
> Am Fr, den 24.09.2004 um 13:43 Uhr +0100 schrieb Peter Lovatt:
>=20
>=20
it you are not submitting a password
" .
r
e
ng.
>=20
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20
>=20
--=20
Pablo M. Rivas. http://pmrivas.ipupdater.com http://www.r3soft.com.ar
-----------------------------------------------------------
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.