crrazyjane Posted June 4, 2010 Share Posted June 4, 2010 Ok guys - I'm officially stumped. Here's the code in question: $username="thering_thering"; $password="******"; $database="thering_slotdata"; mysql_connect("localhost", $username, $password) or die(mysql_error()); mysql_select_db("thering_slotdata") or die(mysql_error()); $query="SELECT * FROM slotinfo WHERE promoEndDate>='".$date."' ORDER BY promoStartDate LIMIT 1"; $result = mysql_query($query); mysql_close(); And here's what I'm getting: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'thering_thering'@'localhost' (using password: YES) in C:\xampplite\htdocs\playersring\inc\ring-season-function.php on line 10 Access denied for user 'thering_thering'@'localhost' (using password: YES) I've triple-checked my username and password. This is happening both on my virtual server (xampp lite) and on the live site. Everything works FINE if I do not use a password - ie, connecting through the "root" user with no password. I even tried adding a password to the root user, just for kicks, and as soon as I did - same error. I've set the permissions for this user to absolutely freaking everything allowed, just in case it was a permissions problem - still no go. I've googled this up the ying-yang and the only advice I'm seeing is "double check your username and password" - but I HAVE. A LOT. Does anyone have any idea what else could be causing this error?? Quote Link to comment Share on other sites More sharing options...
TheBG Posted June 4, 2010 Share Posted June 4, 2010 Well, since the error message echos your user name correctly and confirms you're using a password, there just isn't a whole lot of wiggle room. Just for giggles, change your password in SQL and then try it again with the new password. Quote Link to comment Share on other sites More sharing options...
jskywalker Posted June 4, 2010 Share Posted June 4, 2010 or try to connect with your root-account and do this: use 'thering_slotdata'; show grants for 'thering_thering'; it should give details on what priviliges this account has... Quote Link to comment Share on other sites More sharing options...
crrazyjane Posted June 4, 2010 Author Share Posted June 4, 2010 Okay - I'm getting closer now - I tried looking at what privileges my thering_thering user had - and nothing came up. Poked around a bit further, went into myphpAdmin, and saw that the user doesn't have privileges for any databases as of yet. I tried to add one - and I got the following error: #1133 - Can't find any matching row in the user table I went back over to the user table in the mysql database - and thering_thering is most certainly showing up there. I'm thinking this is probably the root of my mysql_connect problem. Any idea what this error means? Quote Link to comment Share on other sites More sharing options...
crrazyjane Posted June 4, 2010 Author Share Posted June 4, 2010 Sorry - let me be a little clearer. The user thering_thering is showing up everywhere it's supposed to in phpMyAdmin - I can see it in my user table in the mysql database. It is showing up as having privileges for all the databases I want it to have privileges for. The problem is happening when I try to run a grant statement - it acts as though the user does not exist. This is definitely starting to look like a mysql problem rather than a php one - should I move this over to the mysql forum?? Quote Link to comment Share on other sites More sharing options...
phoenixx Posted June 4, 2010 Share Posted June 4, 2010 Are you using cPanel on your virtual host? It's definitely not your syntax. Quote Link to comment Share on other sites More sharing options...
crrazyjane Posted June 4, 2010 Author Share Posted June 4, 2010 No, not cPanel. I mostly jump right over Xampp's own control panel and am trying to manage this all directly from phpMyAdmin. Quote Link to comment Share on other sites More sharing options...
jskywalker Posted June 4, 2010 Share Posted June 4, 2010 paste the relevant info from the "Edit Privileges: 'thering_thering'@'localhost': from phpmyadmin. otherwhise we can onyl *guess* what u are seeing...... Quote Link to comment Share on other sites More sharing options...
crrazyjane Posted June 4, 2010 Author Share Posted June 4, 2010 Sorry - wasn't pasting right, so I just used images. <br><br> Let me know if you need any other screenshots or info! I appreciate the help. Quote Link to comment Share on other sites More sharing options...
jskywalker Posted June 5, 2010 Share Posted June 5, 2010 this information seems OK..... btw, screendump should give same information as: select * from information_schema.user_privileges where GRANTEE LIKE '%thering_thering%'; i think the quicked solution might be: DROP USER thering_thering; and afterward re-create this user..... byt maybe someone else has a better solution? Quote Link to comment Share on other sites More sharing options...
ngoweb Posted June 5, 2010 Share Posted June 5, 2010 After you created the user and change the permissions, you should flush the privileges that may be the issue. Quote Link to comment Share on other sites More sharing options...
crrazyjane Posted June 7, 2010 Author Share Posted June 7, 2010 dropping the user and recreating it directly with a sql create user statement (instead of insert) did the trick! Thanks guy! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.