1071 Specified key was too long;

  • Maik Stroebert
    Participant
      # 6 days, 17 hours ago

      Hello,
      after typing php artisan bap:install, i become the follow error:

      comments_commentable_id
      _commentable_type_index(commentable_id,commentable_type))

      In PDOStatement.php line 143:

      SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max
      key length is 1000 bytes

      In PDOStatement.php line 141:

      SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max
      key length is 1000 bytes

      My PHP version is 7.2.1 and the MySql Server is 5.7

    • laravel-bap
      Keymaster
        # 6 days, 14 hours ago

        Hi,

        here is info how to solve this issue:

        https://laravel-news.com/laravel-5-4-key-too-long-error

        if this won’t work You can also try to change mysql.charset from utf8mb4 to utf8 in database.php (remember to run php artisan config:cache).

        ‘mysql’ => [
        ‘charset’ => ‘utf8’,
        ‘collation’ => ‘utf8_unicode_ci’,

        ],

        Plese let me know it this helped You.

      • Maik Stroebert
        Participant
          # 5 days, 15 hours ago

          Hello,

          i tried to force migration, now it works.

          Thank you

        You must be logged in to reply to this topic.