Current location: Hot Scripts Forums » Other Discussions » Database » mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password:


mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password:

Reply
  #1 (permalink)  
Old 04-17-09, 08:23 AM
bigsombrero bigsombrero is offline
New Member
 
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password:

I hope this is the right place for this.

I've got a mac mini Intel Core Duo running Mac OS X Leopard with MySQL 6 alpha installed. I used entropy.ch's php5 build with GD library instead of the built-in Leopard php5 build.

It all seems to be working perfectly except for the connection to MySQL, and it has been driving me nuts for the large part of a week of hours of trying to get it to work.

My specific problem is that I can log into MySQL through the terminal as root and using a password I set up for it. However, using the same root/password combination in a php file with the mysql_connect() function gives me the all annoying:
mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES)

Trolling through loads of posts I found that people usually say "you have the incorrect password", but I'm certain, 100%, that it's correct, especially since I can log in through terminal to mysql using it!

For some weird reason, root just isn't allowed to access the mysql server. I've tried re-installing MySQL, to much the same result. I have also created a different user with all privileges and tried that user in the php script, but to no avail. So this leads me to believe it really isn't a username/password issue but a connection problem although PHP is able to contact the MySQL server because otherwise it wouldn't give me the error:
mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES)

I'm really stumped and would appreciate any help anyone may give. My brain's out of ideas for the moment. If only I could get this to work... I love PHP and MySQL but I must admit we're not on speaking terms at the moment :=(

Thanks!
Reply With Quote
  #2 (permalink)  
Old 04-17-09, 08:59 AM
bigsombrero bigsombrero is offline
New Member
 
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
P.S. I can connect if I use localhost as the username and leave the rest blank, but I have no prvilages and this isn't optimal. So my php would look something like msyql_connect('localhost','localhost',''); Very strange....
Reply With Quote
  #3 (permalink)  
Old 04-17-09, 09:14 AM
namecomp namecomp is offline
Newbie Coder
 
Join Date: Apr 2009
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
maybe the host and a certain port for the mysql db?
Reply With Quote
  #4 (permalink)  
Old 04-17-09, 09:21 AM
bigsombrero bigsombrero is offline
New Member
 
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
namecomp,

Thanks for that. I'm not entirely sure what you mean by that.
I've ported port 3306 over to the machine running the msql server, and also tried using 'locahlost:3306' explicitly, although this is done by default, I think when one uses 'localhost'.

Any other ideas?

Thanks
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning: mysql_query() [function.mysql-query]: Access denied for user 'mylogi'@'localhost' (using pa tut123408 PHP 6 05-27-08 11:50 PM


All times are GMT -5. The time now is 05:07 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.