can't connect to mysql while offline

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
paul_r
Forum Newbie
Posts: 9
Joined: Fri Jun 13, 2003 11:21 pm

can't connect to mysql while offline

Post by paul_r »

hello! why can't i connect to my mysql database server while i'm offline? But when i'm connected to the internet, i'm able to connect to it. I use COMPUTERNAME in mysql_connect() method. I have already tried localhost and 127.0.0.1. i also tried appeding the port, 3306. Still nothing when offline. i'm using iis under windows xp pro. Pls help. thanks!
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

What kind of error message do you get if you try and connect when you're offline?

Mac
paul_r
Forum Newbie
Posts: 9
Joined: Fri Jun 13, 2003 11:21 pm

Post by paul_r »

the error i get when i'm offline:

Warning: mysql_connect(): Access denied for user: 'rivera@127.0.0.1' (Using password: YES) in c:\inetpub\wwwroot\mysql.php on line 15
rivera

But my script runs perfectly fine when i'm online. Here's my script:

<?php
$username="rivera";
$password="rivera";
$database="myfirstdatabase";

mysql_connect("PAUL",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM MyFirstTable";
$result=mysql_query($query);

$first=mysql_result($result,0,"name");
printf( $first );
?>

i have a database named myfirstdatabase with a table named myfirsttable. myfirsttable has two columns: name and idnum. thanks!
Post Reply