Laravel 6 – Syntax error or access violation
Laravel has made a change to the default database character set, and it’s now utf8mb4 which includes support for storing emojis. This only affects new applications and as long as you are running MySQL v5.7.7 and higher you do not need to do anything.
For those running MariaDB or older versions of MySQL you may hit this SYNTAX ERROR OR ACCESS VIOLATION error when trying to run migrations:
Here is how we can solve this problem.
There is a simple step to fix this problem.
Step 1. Go to your project root directory
Step 2. Open config directory
Step 3. Now open database.php file using your favorite text editor or code editor, mine is a sublime text
Step 4. find Mysql connection setting and Charset & collation
Step 5. Change utf8mb4 to utf8
step 6. Change collation to utf8_unicode_ci
That’s it.
![]() |
| Laravel Mysql Connection Setting |


Leave a Reply