|
-
Aug 1st, 2005, 04:58 AM
#1
[RESOLVED] MySQL in linux...
I am going to kill someone soon. I was first told that I had to compile MySQL from source, something I have never done before. Then I installed Apache and then PHP. But something was wrong with MySQL, so I was told that I could Apt-get it, something that is SOOO much easier. But will that work AFTER I have installed Apache2 and PHP4? I tried to follow VisualAds tutorial, even if it is for windows, but something must have gone wrong. When I get to the point where I am going to test to see if MySQL is working from PHP, and I use this script:
PHP Code:
<?php
$username = 'php';
$host = '.'; // this forces connection through a named pipe
$pw = 'secret';
if (! mysql_connect($host, $username, $pw)) {
die('Connection error: ' . mysql_error());
}
mysql_select_db('php_general');
$query = 'SELECT colname FROM test';
if (! $result = mysql_query($query)) {
die('Query error: ' . mysql_error());
}
?>
<html>
<head>
<title>Test Database Script</title>
</head>
<body>
<table>
<?php while($row = mysql_fetch_row($result)): // loop through all records?>
<tr>
<td><?php echo($row[0]) ?></td>
</tr>
<?php endwhile; ?>
</table>
</body>
</html>
I get an error on line 7 there, saying:
Warning: mysql_connect(): Unknown MySQL Server Host '.' (4) in /usr/local/apache/htdocs/phpmysql1.php on line 7
Connection error: Unknown MySQL Server Host '.' (4)
and if I try to change the host to anything else like local host, then I get this error:
Warning: mysql_connect(): Host 'localhost.localdomain' is not allowed to connect to this MySQL server in /usr/local/apache/htdocs/phpmysql1.php on line 7
Connection error: Host 'localhost.localdomain' is not allowed to connect to this MySQL server
Any idea about what I am not understanding here?
Thanks
- ØØ -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|