Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

RE: [PHP-DB] Newbie Question - mysql_select_db fails with access denied.
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

Report this thread to moderator Post Follow-up to this message
Old Post
Peter Lovatt
09-24-04 01:56 PM


Re: [PHP-DB] Newbie Question - mysql_select_db fails with access denied.
You'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
-----------------------------------------------------------

Report this thread to moderator Post Follow-up to this message
Old Post
Pablo M. Rivas
09-24-04 08:58 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:25 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.