Re: connect to db with php?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1. The default user table sets up root with no password.  Leave out the password and it will probably connect OK.  You really need to fix the user table, but as long as the system isn't accessible from outside, you can get by.

2.  You don't need to use "host", in this case 127.0.0.1, when connecting from the same machine.  It doesn't hurt, but it may add confusion at some future point in your troubleshooting.

3.  All of this is really mysql specific and you would do better using that list, too.

Doug


On Sun, 22 Jun 2003 00:45:12 +1000, David wrote:

>Warning - beginner  :-)  I'm new at Linux, php and mysql, so please go slowly.
>
>I have a test database with a couple of tables, etc., that I can connect to 
>and run simple queries against, etc., all from the command line. I do most 
>things as root, probably because I didn't set it up right and haven't fixed 
>it.
>
>I'm trying to put together a simple php script to connect to the database and 
>learn about both at the same time. At the moment I have something like this:
>
><?php
>$conn = mysql_connect("127.0.0.1","root","password","databasename");
>if (!$conn) die ("Could not connect");
>blah blah
>?>
>
>which gives this result:
>Warning: Access denied for user: 'root@localhost.localdomain' (Using password: 
>YES) in /var/www/html/php/script1.php on line 9
> (line 9 is the $conn line, above)
>
>I've tried a few variations but I'm not sure where to go from here.
>Can anyone help out?
>thanks
>David
>
>-- 
>
>
>The arm folds in at the elbow, not out
>
>
>-- 
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux