close

[Solved] Laravel: String data, right truncated: 1406 Data too long for column

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Laravel: String data, right truncated: 1406 Data too long for column in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Laravel: String data, right truncated: 1406 Data too long for column Error Occurs?

Today I get the following error Laravel: String data, right truncated: 1406 Data too long for column in php.

How To Solve Laravel: String data, right truncated: 1406 Data too long for column Error ?

  1. How To Solve Laravel: String data, right truncated: 1406 Data too long for column Error ?

    To Solve Laravel: String data, right truncated: 1406 Data too long for column Error Change column's datatype from string to text and do not give length.

  2. Laravel: String data, right truncated: 1406 Data too long for column

    To Solve Laravel: String data, right truncated: 1406 Data too long for column Error Change column's datatype from string to text and do not give length.

Solution 1

You need to create a new migration, register it with composer du command and run php artisan migrate command to change type of the column:

Schema::table('the_table_name', function (Blueprint $table) {
    $table->string('hotel', 255)->change();
});

Solution 2

Change column’s datatype from string to text and do not give length.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment