0
我在Homestead中編寫代碼與Laravel 5.3,一切正常。 當我上傳我的代碼到生產服務器,並數據庫的新用戶名,數據庫用戶名未在Laravel 5生產模式中更改
,並授予 grant all on drns.* to [email protected] identified by 'drns****';
更改.ENV到
APP_ENV=production
APP_KEY=base64:695XOiuHsxXXXXXXXXXXXLOX9gBE74=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://myip/
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=drns
DB_USERNAME=drns
DB_PASSWORD=drns****
運行工匠php artisan route:cache && php artisan config:cache && php artisan view:clear
然後我測試我的網站,控制器中的每個功能[創建/更新]它通常工作, 但在文檔控制器上的功能更新說錯誤abou牛逼宅基地的用戶名
QueryException in Connection.php line 770:
SQLSTATE[HY000]: General error: 1449 The user specified as a definer ('homestead'@'%') does not exist
(SQL: update `documents` set `revision` = `revision` + 1, `number` = 0001.13/1, `title` = test, `urgency` = normal, `updated_at` = 2017-04-20 02:41:54 where `id` = 68)
我的代碼
public function update(DocumentRequest $request, $id)
{
$document = Document::findOrFail($id);
if ($document->increment('revision', 1, [
'number' => $request->get('number'),
'title' => $request->get('title'),
'urgency' => $request->get('urgency')]))
{
return redirect()->route('document.show', $id);
}
return redirect()->back()->with('error', 'Can't update!');
}
在這樣的更新功能的另一個控制器,但沒有任何錯誤。
請給我建議。
我有一個類似的問題,我用一個視圖創建轉儲文件..用戶是不同於我的環境。 –