Re: MySQL problem -- new to PHP
| From: | Mignon Hunter | Date: | Thu, 13 Feb 2003 15:02:12 +0000 |
| Subject: | Re: MySQL problem -- new to PHP | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-25611@lists.php.net to get a copy of this message | ||
When changing/adding permissions to the mysql db for specific users,
dont forget to do 'flush privileges'...
my 2 cents
On Thu, 2003-02-13 at 07:19, Evan Morris wrote:
> 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)
--
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461