I'm a newbie running Drupal 6.15 / CCK 6.x-2.6 / XAMPP stack / MySQL 5.1.41 / PHP 5.
After entering some PHP code in the allowed values box when adding a field in CCK content types, I receive the following error messages:
"# warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in
C:\xampp\htdocs\drupal\sites\all\modules\cck\content.module(1694) : eval()'d code on line 2.
# warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\xampp\htdocs\drupal\sites\all\modules\cck\content.module(1694) : eval()'d code on line 2."
Then, when I try to go to Admin (http://localhost/drupal/admin) I get this error displayed on an otherwise blank page, with no menus or content:
"Access denied for user 'ODBC'@'localhost' (using password: NO)"
I cannot access the Admin area, although I can double-back and access regular pages in the website. I could perhaps remedy the problem by removing or repairing the offending code, but I can't seem to get back in through Admin to do it!
NOTE: this problem appears to be similar to http://drupal.org/node/424808 , but in my case I cannot get into Admin to make changes.
Any assistance would be greatly appreciated. Thanks.
Comments
Comment #1
vkareh commentedSeems like your database connection string in settings.php is not right. Try looking at the
$db_urlvariable and making sure that it follows the proper defintion:$db_url = 'mysqli://username:password@host/database;Also, make sure that any weird characters are being escaped in your password. If you have * or @ as part of your password, make sure they are being escaped to %2A and %40, respectively.
Comment #2
jdube commented(thanks, and sorry for my delay in responding - we were moving our offices)
I am building my site locally; so for now in settings.php, I have this pattern:
$db_url['default'] = 'mysqli://username:password@localhost/drupal';
$db_url['other_database'] = 'mysqli://username:password@localhost/other_database';
$db_prefix = '';
Neither username nor password have any weird characters.
Not sure this will help, but in the Drupal database 'watchdog' table, I see:
Delete
379
1
php
%message in %file on line %line.
a:4:{s:6:"%error";s:7:"warning";s:8:"%message";s:8...
3
http://localhost/drupal/admin/build/views/ajax/dis...
http://localhost/drupal/admin/build/views/edit/con...
127.0.0.1
1284753606
I can't seem to find the offending code anywhere else in the database, but there are a lot of tables. Just wish I could get back in Drupal...
---------------------------------------------------------
Follow-up: In phpmyadmin I identified the php code which i had entered in the 'allowed values' box for a field in my content type. I located the code in the column 'global_settings' of the table 'content_node_field'. As an experiment, I manually edited the text so that instead of:
a:4:{s:15:"text_processing";s:1:"0";s:10:"max_length";s:0:"";s:14:"allowed_values";s:0:"";s:18:"allowed_values_php";s:193:"$query="select concept_name from complete";
$exe_query=mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_array($exe))
{
$results[]=$row['concept_name'];
}
return $results;";}
it now reads (similar to my other fields, which have no allowed values:
a:4:{s:15:"text_processing";s:1:"0";s:10:"max_length";s:0:"";s:14:"allowed_values";s:0:"";s:18:"allowed_values_php";s:0:"";}
I stopped and started Apache and MySQL. This has not helped me gain greater access to Drupal admin areas, and i still the same (php?) error.
However, I found that if I enter:
http://localhost/drupal/admin/user?=admin
I can access admin areas such as site configuration, content management (including content types), etc. BUT, if I try to go to Site Building / Views (http://localhost/drupal/admin/build/views) - I get only a blank page with the error:
Access denied for user 'ODBC'@'localhost' (using password: NO)
I have read that Windows will assign an unidentified user (or no user) to the name 'odbc", but I am uncertain what to do. Is it possible that somehow when the improper php code ran once, it caused the 'odbc' username setting, and I must change that somewhere?
I would really appreciate any ideas or suggestions on solving this so I can get back to work.
Comment #3
jdube commentedJust wanted to note that since I was unable to determine how to re-access my admin area to correct what was wrong with the code in the "allowed values" field, I "resolved" this problem by:
clearing the cache.
And (for now) I am just utilizing the UIs of modules, avoiding the use of php code until I gain more knowledge.