Ask a Question related to PHP Development, Design and Development.
-
Tony Benham #1
mysql_connect not working ?
I'm using apache 1.3.28 php 4.3.9 mysql 4.1 on my machine which runs
win2000.
I can connect to the apache server from a browser, and run a script with
phpinfo included which tells me mysql support is installed.
I can run mysql from the command console, and create databases/tables etc.
However when I try to connect to mysql from a php script, mysql_connect
cannot connect to mysql.
The function returns false.
Any ideas how I can see what is happening, or what might be wrong ?
Regards
Tony
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
Tony Benham Guest
-
problem with mysql_connect
hi, can you give me the exact error message? And is it right to put the @ there? It works great with this syntax: @... -
[PHP] mysql_connect error
on 25/08/2003 12:11 PM, John W. Holmes at holmes072000@charter.net wrote: Error line 43 (or 42 if 43 commented out and 42 uncommented) 38: ... -
mysql_connect error
Hi, again this line is causing problems: $h = mysql_connect('localhost',constant("mysql_user"),constant("mysql_password")) ; Aparantly a... -
parse error with mysql_connect
Hi, The prototype for mysql_connect is: resource mysql_connect ( ]]]] ) As you can see you get parse error because the fourth argument... -
mysql_connect() fails randomly
i've got a library file that i require() in all my scripts. it starts with this line: $dbh=mysql_connect() or die("mysql connect failed: " .... -
iuz #2
Re: mysql_connect not working ?
Tony Benham wrote:
can you post the code that return the error?!> I'm using apache 1.3.28 php 4.3.9 mysql 4.1 on my machine which runs
> win2000.
> I can connect to the apache server from a browser, and run a script with
> phpinfo included which tells me mysql support is installed.
> I can run mysql from the command console, and create databases/tables etc.
> However when I try to connect to mysql from a php script, mysql_connect
> cannot connect to mysql.
> The function returns false.
> Any ideas how I can see what is happening, or what might be wrong ?
> Regards
> Tony
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
> Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
--
[url]www.iuz-lab.info[/url]
iuz Guest
-
Tony Benham #3
Re: mysql_connect not working ?
Hi,
The code is very simple
@ $db = mysql_connect('localhost', 'username', 'password');
if (!$db)
{
echo 'Error: Could not connect to database, Please try again later.';
exit;
}
Tony
"iuz" <user@host.network> wrote in message
news:oFV8d.73615$35.3739320@news4.tin.it...etc.> Tony Benham wrote:
>> > I'm using apache 1.3.28 php 4.3.9 mysql 4.1 on my machine which runs
> > win2000.
> > I can connect to the apache server from a browser, and run a script with
> > phpinfo included which tells me mysql support is installed.
> > I can run mysql from the command console, and create databases/tables>> > However when I try to connect to mysql from a php script, mysql_connect
> > cannot connect to mysql.
> > The function returns false.
> > Any ideas how I can see what is happening, or what might be wrong ?
> > Regards
> > Tony
> >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
> > Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
> can you post the code that return the error?!
>
> --
> [url]www.iuz-lab.info[/url]
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
Tony Benham Guest
-
Virgil Green #4
Re: mysql_connect not working ?
"Tony Benham" <tonyb@kerrisway.freeserve.co.uk> wrote in message
news:2sio28F1limqaU1@uni-berlin.de...After this, put:> Hi,
> The code is very simple
> @ $db = mysql_connect('localhost', 'username', 'password');
if (mysql_errno()) echo mysql_errno() . ':' . mysql_error() . '<br>';
and see if that tells you what is wrong.
> if (!$db)
>
> {
>
> echo 'Error: Could not connect to database, Please try again later.';
>
> exit;
>
> }
>
> Tony
Virgil Green Guest
-
Tony Benham #5
Re: mysql_connect not working ?
Hi,
I switched error reporting on ,and got the following error.
Warning: mysql_connect(): Client does not support authentication protocol
requested by server; consider upgrading MySQL client in results.php on line
23
I can connect from the mysql monitor wiithout any problem.
Any ideas what this is ?
Tony
"Tony Benham" <tonyb@kerrisway.freeserve.co.uk> wrote in message
news:2sio28F1limqaU1@uni-berlin.de...with> Hi,
> The code is very simple
> @ $db = mysql_connect('localhost', 'username', 'password');
>
> if (!$db)
>
> {
>
> echo 'Error: Could not connect to database, Please try again later.';
>
> exit;
>
> }
>
> Tony
>
> "iuz" <user@host.network> wrote in message
> news:oFV8d.73615$35.3739320@news4.tin.it...> > Tony Benham wrote:
> >> > > I'm using apache 1.3.28 php 4.3.9 mysql 4.1 on my machine which runs
> > > win2000.
> > > I can connect to the apache server from a browser, and run a scriptmysql_connect> etc.> > > phpinfo included which tells me mysql support is installed.
> > > I can run mysql from the command console, and create databases/tables> > > However when I try to connect to mysql from a php script,>> >> > > cannot connect to mysql.
> > > The function returns false.
> > > Any ideas how I can see what is happening, or what might be wrong ?
> > > Regards
> > > Tony
> > >
> > >
> > >
> > > ---
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
> > > Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
> > can you post the code that return the error?!
> >
> > --
> > [url]www.iuz-lab.info[/url]
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
> Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
Tony Benham Guest
-
Tony Benham #6
Re: mysql_connect not working ?
Hi,
I found the error was the new password hashing algorithm in MySQL4.1 up.
PHP4.3.9 I guess uses the old algorithm. Anyway I set 4.1 to use the old
style passwords and it's now fine.
Thanks for the help.
Tony
"Virgil Green" <vjg@DESPAMobsydian.com> wrote in message
news:SxW8d.1575$Lk3.597@newssvr12.news.prodigy.com ...> "Tony Benham" <tonyb@kerrisway.freeserve.co.uk> wrote in message
> news:2sio28F1limqaU1@uni-berlin.de...>> > Hi,
> > The code is very simple
> > @ $db = mysql_connect('localhost', 'username', 'password');
> After this, put:
> if (mysql_errno()) echo mysql_errno() . ':' . mysql_error() . '<br>';
>
> and see if that tells you what is wrong.
>>> > if (!$db)
> >
> > {
> >
> > echo 'Error: Could not connect to database, Please try again later.';
> >
> > exit;
> >
> > }
> >
> > Tony
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
Tony Benham Guest



Reply With Quote

