Friday, March 17, 2017

MySQL Laravel 5.4 Import database issue

I have the latest Laravel 5.4, and running on the latest Homestead 2.0 (with MySQL 5.7.12).

This is my 1.sql file (replaced from the actual database):

select now();

I am trying to run this command:

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

Laravel keeps throwing this error:

[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i n your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'path_to_file/1.sql' at line 1

As I notice, no matter what's in 1.sql, Laravel throws the error. When import the actual .sql file, Laravel imports it without error.

Any solutions?



via Santosh Achari

Advertisement