2011-09-01 84 views
1

我剛搬到我的Drupal網站到另一個域/主機Mysql的例外:SQLSTATE [HY000] [2013]

我感動的DB,現在我所有的網站。但是,當我瀏覽網頁(juniorsteps.be),我得到以下異常:

PDOException: SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in lock_may_be_available() (line 165 of /home/sites/webhosting/juniorsteps/juniorsteps/www/includes/lock.inc).

我GOOGLE了,但我仍然沒有找到一個解決方案。

希望有人能幫忙。

UPDATE

由於要求從行的代碼。這是下面的函數的第一行:

function lock_may_be_available($name) { 
    $lock = db_query('SELECT expire, value FROM {semaphore} WHERE name = :name', array(':name' => $name))->fetchAssoc(); 
    if (!$lock) { 
    return TRUE; 
    } 
    $expire = (float) $lock['expire']; 
    $now = microtime(TRUE); 
    if ($now > $expire) { 
    // We check two conditions to prevent a race condition where another 
    // request acquired the lock and set a new expire time. We add a small 
    // number to $expire to avoid errors with float to string conversion. 
    return (bool) db_delete('semaphore') 
     ->condition('name', $name) 
     ->condition('value', $lock['value']) 
     ->condition('expire', 0.0001 + $expire, '<=') 
     ->execute(); 
    } 
    return FALSE; 
} 

但說實話,我不認爲錯誤是在我的代碼,因爲它完美的作品我的開發服務器上。

+0

投票決定關閉,您的問題無法以目前的形式回答,我們需要比這樣更多的細節。 '/ home/sites/webhosting/juniorsteps/juniorsteps/www/includes/lock.inc'的第165行附近的代碼將是一個很好的開始。 – Johan

+0

我添加了代碼,但我不認爲它是代碼,因爲該網站在我的開發服務器上工作,現在我移動它,我得到了錯誤。 :■ –

回答

6

檢查您的settings.php

$databases = array (

    'default' => 

    array (

    'default' => 

    array (

     'database' => '333333', 

     'username' => '333333', 

     'password' => '3333333', 

     'host' => '122.124.12.09', // check host -> maybe not localhost 

     'port' => '3304', // check port! 

     'driver' => 'mysql', 

     'prefix' => '', 

    ), 

    ), 

    ); 
1

我有同樣的問題。該網站的開發版本設置爲與Acquia開發環境配合使用。 settings.php錯誤。從sites/default/settings.php文件的底行刪除所有Acquia特定信息。

相關問題