Jump to content

Q on MySQL/PHP


9AF

Recommended Posts

I have recently started to work on MySQL, PHP and apache and I\'m still finding my way round. Having installed apache 2.0.44 (successfully), with MySQL 4.0 and PHP 4.3.2 I found this script which is suppose to help show that all works with PHP/MySQL. The code is:

 

<html>

<head><title></title></head>

<body>

<?php

$host=\"localhost\";

$user=\"pj\";

$password=\"buzz\";

mysql_connect($host, $user, $password);

$db_table = mysql_list_dbs();

for ($i = 0; $i < mysql_num_rows($db_table); $i++) {

echo(mysql_tablename($db_table, $i));

echo(\"

\");

}

?>

</body>

</html>

 

However, I keep on getting this error:

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user: \'rb@127.0.0.1\' (Using password: YES) in C:Program FilesApache GroupApache2htdocstest.php on line 8

mysql test

 

Is this test that I\'m trying to do valid? If so what have I done wrong. Any feedback would be much appreciated.

 

Regards

 

9AF

Link to comment
Share on other sites

It\'s not your test, it\'s your access that is the problem...

 

You probably have a special password set for the user pj@localhost...

 

That\'s the error anyway... Try and connect with

 

mysql -h localhost -u pj -p buzz from a terminal window...

 

And/Or browse the mysql:user table...

 

Hope this helps,

P.

Link to comment
Share on other sites

Thanks for the responses. I have managed to solve the problem by using user \'root\' and a password set to user \'root\'. The PHP code runs fine now. Though I did set a user and a password using mysqladmin for some reason nothing happened (defnitely something to do with permissions). In the documentation it does state somewhere to use user \'root\' when first using a new installation of MySQL as it has all the permissions set already.

 

Thanks again for your help its much appreciated.

 

9AF

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.