티스토리 뷰
반응형
Illuminate\Database\QueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.cache' doesn't exist (Connection: mysql, SQL: delete from cache)
캐시 테이블 생성 오류 해결
해결 방법 1: 캐시 테이블 마이그레이션 생성
bash
# 캐시 테이블 생성
php artisan cache:table
# 마이그레이션 실행
php artisan migrate
해결 방법 2: 전체 캐시 설정 확인 및 재설정
bash
# config 캐시 클리어
php artisan config:clear
# 캐시 클리어
php artisan cache:clear
# view 캐시 클리어
php artisan view:clear
# route 캐시 클리어
php artisan route:clear
# 캐시 테이블 생성
php artisan cache:table
php artisan queue:table
php artisan session:table
# 마이그레이션 실행
php artisan migrate
해결 방법 3: .env 파일에서 캐시 드라이버 변경
.env 파일 수정
env
# 기존
CACHE_DRIVER=database
# 변경 (임시로 file 사용)
CACHE_DRIVER=file
# 또는
CACHE_DRIVER=array
변경 후:
bash
php artisan config:cache
해결 방법 4: 수동으로 캐시 테이블 생성
database/migrations/xxxx_create_cache_table.php
php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
public function down()
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
bash
php artisan migrate
추천 순서
bash
# 1단계
php artisan config:clear
php artisan cache:clear
# 2단계
php artisan cache:table
# 3단계
php artisan migrate
# 4단계 (확인)
php artisan tinker
>>> Cache::put('test', 'value', 60);
>>> Cache::get('test');
완료 후 설정
.env (데이터베이스 캐시 사용 시)
env
CACHE_DRIVER=database
QUEUE_CONNECTION=database
SESSION_DRIVER=database
.env (파일 캐시 사용 시 - 단순한 경우)
env
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
반응형
'laravel' 카테고리의 다른 글
| github 에서 서버로 CI/CD 자동배포 설정 (0) | 2025.10.10 |
|---|---|
| Git 연결 세팅 (0) | 2025.10.10 |
| Storage 심볼릭 링크 설정 (0) | 2025.10.08 |
| Laravel 프로젝트 생성 가이드 (0) | 2025.10.08 |
| 저렵한 서버 호스팅 찾기 (0) | 2025.10.08 |
댓글
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 의정부 삼계탕
- ci/cd
- 스크립트강좌
- 라라벨프로젝트
- 깃생성
- 엔진엑스설정
- css
- nginx설정
- citykid
- 홈마
- 깃계정변경
- 라라벨
- 깃허브자동배포
- Accessor
- 스크립트기초
- 프로젝트생성
- 라라벨설정
- 캐시테이블
- 더서니
- 서니
- 민락골
- 홈마뜻
- 메서드호출
- 깃연동
- 신규생성
- 깃자동배포
- php신규생성
- laravel
- github
- thesunny
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
글 보관함
반응형