MySQL & PHP Error

Get help on web editors (Frontpage, Dreamweaver) and web languages (HTML, ASP, PHP).
Post Reply
FuZzY665
Registered User
Posts: 58
Joined: 11 Aug 2006, 02:00
Location: Durban
Contact:

MySQL & PHP Error

Post by FuZzY665 »

Hi Guys

I'm working on a php site that connects to a MySQL database, but when I try run the site I get this error.
Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\siteFolder\Connections\conn.php on line 9

Fatal error: Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\siteFolder\Connections\conn.php on line 9
I also use Navicat to access the MySQL database and it's also giving me unable to connect error.
Also running XAMPP as a server.
User avatar
Ron2K
Forum Technical Administrator
Posts: 9050
Joined: 04 Jul 2006, 16:45
Location: Upper Hutt, New Zealand
Contact:

Re: MySQL & PHP Error

Post by Ron2K »

Looks like the database authentication details that you're using are incorrect, so check those. :wink:
Kia kaha, Kia māia, Kia manawanui.
FuZzY665
Registered User
Posts: 58
Joined: 11 Aug 2006, 02:00
Location: Durban
Contact:

Re: MySQL & PHP Error

Post by FuZzY665 »

I'll have a look into that.

Do you think perhaps its got something to do with XAMPP, because before we were running the sites from a dedicated server and everything use to work great, but we got rid of that and now we using XAMPP as a local server.
User avatar
Ron2K
Forum Technical Administrator
Posts: 9050
Joined: 04 Jul 2006, 16:45
Location: Upper Hutt, New Zealand
Contact:

Re: MySQL & PHP Error

Post by Ron2K »

Could be. I haven't fiddled with XAMPP for a while (read: since the big forum conversion), but I recall that the default XAMPP installation leaves the MySQL root password blank - could be wrong here though.
Kia kaha, Kia māia, Kia manawanui.
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Re: MySQL & PHP Error

Post by RuadRauFlessa »

Yip the default install does leave root blank. I use one for dev purposes. Careful when changing it though the PHPMyadmin page won't work and you will have to re configure it. That could be your problem. Also MySQL has two ways of storing the password and they are obviously not compatible. I would suggest you have a good read regarding this on MySQL's site.
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
gmccumskey
Registered User
Posts: 6
Joined: 28 Apr 2009, 14:42

Re: MySQL & PHP Error

Post by gmccumskey »

FuZzY665 wrote:Hi Guys

I'm working on a php site that connects to a MySQL database, but when I try run the site I get this error.
Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\siteFolder\Connections\conn.php on line 9

Fatal error: Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\siteFolder\Connections\conn.php on line 9
I also use Navicat to access the MySQL database and it's also giving me unable to connect error.
Also running XAMPP as a server.
The error message you are getting normally has to do with MySQL not allowing remote connections or credentials. Also I would HIGHLY recommend that you change the MySQL root user password to NOT be blank as this is a big security risk.
Damina
Registered User
Posts: 42
Joined: 06 Sep 2005, 02:00
Contact:

Re: MySQL & PHP Error

Post by Damina »

Also try creating a user for that specific database in MySQL and assign it database-specific permissions for the database.
Then use that user in your mysql_connect() function
Post Reply