I've googled all the forums, but nothing has worked.

I was looking at one of my content types, didn't save anything, and all of a sudden this message popped up:

Access denied for user ''@'localhost' (using password: NO)

And I can't view any page now.

In watchdog, this error message is present:

a:4:{s:6:"%error";s:7:"warning";s:8:"%message";s:77:"mysql_select_db(): Access denied for user ''@'localhost' (using password: NO)";s:5:"%file";s:76:"/var/cambridgedev/sites/all/modules/cck/content.module(1694) : eval()'d code";s:5:"%line";i:5;}

I do have some accepted values set with php in some cck fields, but they haven't been changed at all. Just to be sure, I removed them manually from the db, but the messages still persist.

Any ideas on what this could be caused by?

Comments

nrackleff’s picture

That message seems to indicate the the database username and password are not getting properly passed, but I can't think of any reason why the rest of the site would be working fine without the DB username and password. Are the username and password correct in your /sites/default/settings.php file? Could this have anything to do with it? http://drupal.org/node/890102

gatsby0121’s picture

I don't think it applies, I don't have a / in the host name, it's just localhost. Plus, it's not just pages where I make database connections, it's all pages.

The thing is none of the site works. If I restore to a point before the crash, it loads. then as soon as I access the edit content type page, it crashes. After that point, I can't access any page until I restore the db.

gatsby0121’s picture

The issue was php allowed values that I had in the cck fields. I wasn't able to edit it on one server, but when I copied it over to my local machine, it let me edit the field for som reason, after I made the changes (I switched to db_query instead of mysql_query), the problem hasn't resurfaced.

rhiker’s picture

I was trying to add some php code to a block that is displayed on all my pages. Apparently there was some bad code in the block that was causing the error. I used PHPadmin and deleted the block and the site is once again working properly.

Set up your drupal scheduled backups it might save you a ton of time if you do something similar and can't find the offending content.