If you're using root, then you must use the root password in mysql_connect().

----- Original Message ----- 
From: "Gibbs, Liam - SXIA" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 29, 2003 8: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




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

Reply via email to