Re: Newbie Question - mysql_select_db fails with access denied.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx> wrote:
> I have chosen an empty password. I know that this is a security problem.
> I´m using it for testing at the moment only. I use it because there also
> seems to be an issue with php connecting to mysql servers with verions >
> 4.1.
> 
> When trying to connect with password I get this:
> Connect failed : Client does not support authentication protocol
> requested by server; consider upgrading MySQL client.
> 
> 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.
> 
> What really makes me wonder in my tiny example is that the error message
> does not say something like:
> 
> SELECT_DB failed: Access denied for user 'myuser'@'localhost' to
> database 'mydb'
> 
> instead it says:
> SELECT_DB failed: Access denied for user ''@'localhost' to database
> 'mydb'
> 
> So I think that the username is not interpreted at all. Why not?
> 
> Regards,
> 
> Chris
> 
> Am Fr, den 24.09.2004 um 13:43 Uhr +0100 schrieb Peter Lovatt:
> 
> 
> > Hi
> >
> > try $db = mysql_connect("localhost", "myuser","mypassword") - without it  you are not  submitting a password
> >
> > Peter
> >
> > > -----Original Message-----
> > > From: Christian Schlaefcke [mailto:cschlaefcke@xxxxxxxxxxxxxx]
> > > Sent: 24 September 2004 13:31
> > > To: php-db@xxxxxxxxxxxxx
> > > Subject:  Newbie Question - mysql_select_db fails with access
> > > denied.
> > >
> > >
> > > Hi Folks,
> > >
> > > I want to do something like the following:
> > > $db = mysql_connect("localhost", "myuser") or die("Connect failed : " .
> > > mysql_error());
> > >
> > > mysql_select_db("mydb",$db) or die("SELECT_DB failed : " . mysql_error
> > > ());
> > >
> > > $result = mysql_query("SELECT * FROM mytable", $db) or die("Query
> > > failed : " . mysql_error());
> > >
> > > 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'
> > >
> > > What happened to the user information. I have granted all neccessary
> > > rights to "myuser". But it seems that it´s even not caring about the
> > > user.
> > >
> > > I have MySQL 4.1.4 and PHP 4.3.8-2.1 on a Fedore Core 2 System  running.
> > >
> > > Thanks & Regards,
> > >
> > > Chris
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



-- 
Pablo M. Rivas. http://pmrivas.ipupdater.com http://www.r3soft.com.ar
-----------------------------------------------------------

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux