Skip to content

Instantly share code, notes, and snippets.

@mknparreira
Created August 1, 2024 10:22
Show Gist options
  • Save mknparreira/8efcd63aaf93db92bd7276ff63f64f0f to your computer and use it in GitHub Desktop.
Save mknparreira/8efcd63aaf93db92bd7276ff63f64f0f to your computer and use it in GitHub Desktop.
MySQL | Handling errors with laravel
  Error: MYSQL | SQLSTATE [42000]: Syntax error or access violation: 1118 Row size too large (> 8126)

This error may occur when running the command: php php artisan db:seed resulting on the following message:

 SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large (> 8126). 
 Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. 
 In current row format, BLOB prefix of 768 bytes is stored inline.

To fix this issue, you can use the following command:

   ALTER TABLE `<TABLE_NAME>` ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;

Quickly Dropping and Creating a Database

To drop and recreate a database efficiently, use the following SQL commands:

 DROP DATABASE IF EXISTS <DATABASE_NAME>;
 CREATE DATABASE <DATABASE_NAME>;

This guide provides quick solutions for common MySQL issues and tasks related to database management.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment