MySQL infact perfectly understands what localhost is, example:

GRANT ALL PRIVILEGES ON dbname.* TO bob@localhost IDENTIFIED BY 'password';

The above will work fine, and aslong as you connect in your PHP with the username
"bob", and host "localhost" with pass "password" you'll be fine.

On Wed, 2003-01-29 at 12:29, Sunfire wrote:
hi..
i came across the same problem before and it was well lets say i probably
dont have any hair left (from pulling it out) hehe.. anyways you need to go
into the grant tables and look to see what is set up for users.. most likely
you dont have a root@localhost user because as far as i understand
"localhost" as far as mysql is concerned doesnt exist.. no its not a good
idea to run mysql as root but in testing on local computers is fine. try
this if you have to default install try this set of code in your php file:

<?php
m$connect=mysql_connect("[your ip address]", ", "root", "") or die("the
server is down or doesn't exist");
...other code here now...
?>

note when you put your domain name or ip address in the connect function
dont put the brackets there... try that and see what happens


----- Original Message -----
From: "Gibbs, Liam - SXIA" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 29, 2003 9:45 AM
Subject: [PHP] MySQL Madness


> First off, when executing this command:
>
> $connection = mysql_connect("localhost", "root", "");
>
> I get this error msg:
>
> Warning: mysql_connect() [function.mysql-connect]: Access denied for user:
> 'root@localhost' (Using password: NO) in
> /home/superpage/public_html/index.php on line 49
>
> I've gone and read some information on the Internet (understanding almost
> nothing from the technical stuff--I'm a MySQL/server admin newbie), but I
> gathered some information.
>
> Now, a lot of what I read pertains to MySQL and not running it with PHP,
but
> what I did gather from my own gruntwork file-searching and stuff on the
Web
> was that I changed php.ini so that mysql.default_user = root and
> mysql.default_password = my password. Not a smart idea to run MySQL as
root,
> but I'm trying to make headway. I restarted Apache. That didn't work. I
> didn't touch mysql.default_port, .default_host, or .default_socket (don't
> know if I should; didn't find anything that said I should), but I'm really
> stuck on this. Any other information on MySQL pertained strictly to MySQL
> and not PHP, and when I included PHP in my search criteria, it just came
up
> with a bunch of pages that had PHP as an extension or a directory name.
> Searching the PHP-dev archives seems to bring up two search results which
> are the same conversation, and only really mention it in passing from what
I
> understand. Any clues?
>
> I can access MySQL through the command ./mysql -u root -p mysql, but
> obviously that doesn't help when I'm supposed to access it through PHP.
I've
> executed commands there fine.
>
> Not sure if it matters, but I have PHP 4.3.0 and MySQL 11.18 Distrib
3.23.54
> for pc-linux (i686).
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to