RE: MySQL problem -- new to PHP

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

 



If you cut and pasted your code, try to put localhost into quotes as well.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"
mailto:gary.every@ingramentertainment.com
http://accessingram.com


-----Original Message-----
From: evan@exclusivebooks.com [mailto:evan@exclusivebooks.com]
Sent: Thursday, February 13, 2003 7:20 AM
To: php-db@lists.php.net
Subject:  MySQL problem -- new to PHP


Hi all

I am new to PHP (just basically started yesterday). I am currently having a
problem connecting to a MySQL database.

My sample code is:

----------------------------------
<?php
mysql_connect(localhost,"username","password") or die ("Unable to connect to
MySQL server.");
$db = mysql_select_db("DB_NAME") or die ("Unable to select requested
database.");
?>
-----------------------------------

This throws the following error:

-----------------------------------
Warning: MySQL Connection Failed: Host 'my.host.name' is not allowed to
connect to this MySQL server
-----------------------------------

Now, the mySQL server and the web server reside on the same machine. This
warning is therefore saying that this machine does not have permission to
connect to itself. Hmm. I have put entries in the host table and the user
table, using both hostname and ip address, but no luck. I keep getting the
same error.

What am I doing wrong?

Any and all help appreciated.

Thanks

Evan Morris
evan@exclusivebooks.com
+27 11 792 2777 (tel)
+27 11 792 2711 (fax)



-- 
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