Like the Laravel team says in its documentation, Laravel 5 now uses by default the utf8mb4 character set, which includes support for storing "emojis" in the database.

But this can bring some issues if you are using a version of MySQL older than 5.7.7 or MariaDB older than 10.2.2. Like for instance the ones that are brought by default in the latest versions of XAMPP or WAMPP.

You will know that you found this issue when you run the Larvel migrations and the following message appears below:

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; 

max key length is 767 bytes (SQL: alter table `users` add unique `email`(`email`))

Code solution

The first way to solve this could be defining the default string length at execution time for the application. We can doing this open the file app/Provider/AppServiceProvider.php and add the import of the Schema facade with the code below after the service provider import:

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema; // ADD THIS LINE!!

class AppServiceProvider extends ServiceProvider

After that, in the boot method, execute the static method Schema::defaultStringLength() with the new string length, in this case 191:

public function boot()
    Schema::defaultStringLength(191); // ADD THIS LINE!!

MySQL config solution

Other option is modify the InnoDB parameter innodb_large_prefix at MySQL configuration to allow index key prefixes longer than 767 bytes for InnoDB tables that use DYNAMIC or COMPRESSED row format. To do this, open your my.cnf (or on Windows) and add the lines below after the tag [mysqld]:

innodb_large_prefix = On
innodb_file_per_table = On
innodb_file_format = Barracuda

Save and restart MySQL. Now open the file config/database.php and edit the key engine of the connection type mysql, changing it to this:

'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', ''),
    'port' => env('DB_PORT', '3306'),
    'database' => env('DB_DATABASE', 'forge'),
    'username' => env('DB_USERNAME', 'forge'),
    'password' => env('DB_PASSWORD', ''),
    'unix_socket' => env('DB_SOCKET', ''),
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'prefix' => '',
    'strict' => true,
    'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', // THIS LINE!!

And that would be all! Now, just remove the previous created tables and run the Laravel migrations again.