SQLSTATE[01000]: Warning: 1265 Data truncated for column

Posted by

Error:

SQLSTATE[01000]: Warning: 1265 Data truncated for column 'id' at row 1 (Connection: mysql, SQL: insert into oauth_clients (user_id, name, secret, provider, redirect, personal_access_client, password_client, revoked, id, updated_at, created_at) values (?, Professional Personal Access Client, kjdZkvxp4u5LOCZuRvygIzfuJCZ4PT34R6Gm8jL9, ?, http://localhost, 1, 0, 0, 9f247ffc-3966-4e3b-bc7b-18adf24f6974, 2025-06-13 05:05:48, 2025-06-13 05:05:48))

Solution :

Change the id column in oauth_clients to UUID-compatible type CHAR(36)

Step 1: Open MySQL CLI or phpMyAdmin

Then run the following SQL:

-- Drop the primary key (MySQL requires this before altering id)
ALTER TABLE oauth_clients DROP PRIMARY KEY;

-- Remove AUTO_INCREMENT if it exists (important)
ALTER TABLE oauth_clients MODIFY id BIGINT UNSIGNED NOT NULL;

-- Rename old ID column to preserve data
ALTER TABLE oauth_clients CHANGE id old_id BIGINT UNSIGNED NOT NULL;

-- Add a new UUID column
ALTER TABLE oauth_clients ADD id CHAR(36) NOT NULL FIRST;

-- Set UUID column as the new primary key
ALTER TABLE oauth_clients ADD PRIMARY KEY (id);

Step 2: Confirm that id is now UUID-compatible

Run this in MySQL:

SHOW COLUMNS FROM oauth_clients LIKE 'id';

Expected result:

Field | Type     | Null | Key | Default | Extra
------|----------|------|-----|---------|------
id    | char(36) | NO   | PRI | NULL    |

Step 3: Run Laravel Passport command again

php artisan passport:install

Leave a Reply

Your email address will not be published. Required fields are marked *

0
Would love your thoughts, please comment.x
()
x