[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:
Quote:
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:
Quote:
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
- ØØ -
Re: [RESOLVED] MySQL in linux...
I soooooooooooo can't belive this....what is wrong with me....I managed to get this work before I went on a vecation, and then I leave for a vecation and when I get back it doesn't work anymore...and no one as far as I know have used my computer...w00000t....I can't even log on to mysql using command line:
Quote:
PCDSUSI02:/# mysql
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Quote:
PCDSUSI02:/# ./usr/sbin/mysqld
050822 14:25:25 ./usr/sbin/mysqld: unknown variable 'old_passwords=1'
Do I really need to start to cry? Any idea?
Re: [RESOLVED] MySQL in linux...
To make a long story short. There must have been an upgrade on my system, so a never version of mysql-server must have been installed. That made one of the config files buggy. So I had to find this file:
/etc/mysql/my.cnf
and comment out this line:
old_passwords=1
and now everything seems to work again...life is mint..:)
- ØØ -