2017-03-17 252 views
1

我有最新的Laravel 5.4,並運行最新的Homestead 2.0(帶MySQL 5.7.12)。MySQL Laravel 5.4導入數據庫問題

這是我1.SQL文件(從實際的數據庫替換):

select now(); 

我試圖運行這個命令:

DB::unprepared(file_get_content(storage_path('import/1.sql'))); 

Laravel不斷拋出此錯誤:

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to >your MySQL server version for the right syntax to use near 'select now()' at line 1 (SQL: select now();)

正如我注意到的,無論在1.sql中,Laravel都會拋出錯誤。當導入實際的.sql文件時,Laravel無誤地導入它。

任何解決方案?

+0

如果您運行DB :: unprepared('select now();'),會發生什麼情況; ? – Amarnasan

+0

它返回「false」 –

回答