What's Actually Happening
Laravel migrations are locked and cannot run. Database updates are blocked.
The Error You'll See
```bash $ php artisan migrate
SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded ```
Why This Happens
- 1.Stale migration lock - Previous migration didn't complete
- 2.Long running transaction - Another process holding lock
- 3.Database deadlock - Concurrent operations conflicting
- 4.Migration timeout - Migration took too long
Step 1: Check Migration Status
```bash # Check migrations table: php artisan migrate:status
# Check for running migrations: php artisan migrate:status --pending ```
Step 2: Clear Migration Lock
```bash # Force unlock: php artisan migrate --force
# Or clear cache: php artisan cache:clear php artisan config:clear ```
Step 3: Check Database Locks
```sql -- MySQL: SHOW OPEN TABLES WHERE In_use > 0;
SHOW PROCESSLIST;
KILL <process_id>; ```
Step 4: Reset Migration
```bash # Rollback last migration: php artisan migrate:rollback --step=1
# Or reset all: php artisan migrate:reset
# Run fresh: php artisan migrate:fresh ```
Laravel Migration Checklist
| Check | Command | Expected |
|---|---|---|
| Status | migrate:status | Clear |
| Locks | SHOW PROCESSLIST | None |
| Cache | cache:clear | Cleared |
Verify the Fix
php artisan migrate
# Output: Migration completed successfullyRelated Issues
- [Fix Laravel Queue Stuck](/articles/fix-laravel-queue-stuck)
- [Fix Laravel Cache Not Working](/articles/fix-laravel-cache-not-working)