Drupal 7 issue with SQL Mode TRADITIONAL

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1231 Variable ‘sql_mode’ can’t be set to the value of ‘TRADITIONAL’ in lock_may_be_available() (line 165 of /includes/lock.inc).

This was the case when I installed Drupal 7 with Cpanel/Fantastico, the drupal site was displaying the above error.

This issue is discussed at drupal issues . try to patch it as mentioned in the url.

But for me it works with the following change, just removed the TRADITIONAL mode, not  sure it is the correct way to fix it. You can verify the sql modes at http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html ,  Anyway now there is no errors in drupal site and I am able to login.

(includes/database/mysql/database.inc) Line: 65

New file
<  $this->exec(“SET sql_mode=’ANSI,ONLY_FULL_GROUP_BY’”);

Old file
>  $this->exec(“SET sql_mode=’ANSI,TRADITIONAL’”);

Also setting up the sql connection mode to SET SESSION sql_mode = "ANSI,TRADITIONAL";is an option instead of above change.

./arun

 

 


Comments

One response to “Drupal 7 issue with SQL Mode TRADITIONAL”

  1. Arun N S Avatar

    Noticed that this issue is with the MySQL version , Drupal 7 requires >= MySQL 5.0.15 with PDO. http://drupal.org/requirements#database .

    ./arun

Leave a Reply

Your email address will not be published. Required fields are marked *