gpt4 book ai didi

mysql - SQLSTATE[HY000] : General error: 1030 Got error 168 when running migrations

转载 作者:行者123 更新时间:2023-12-05 06:58:12 35 4
gpt4 key购买 nike

我全新安装了 laravel 7,我通过 composer 安装了它,创建了数据库并连接到 .env 中。但是,当我运行迁移时,我看到以下错误:

    ➜  laravel-adp-4 git:(develop) ✗ php artisan migrate

Illuminate\Database\QueryException

SQLSTATE[HY000]: General error: 1030 Got error 168 - 'Unknown (generic) error from engine' from storage engine (SQL: create table `migrations` (`id` int unsigned not null auto_increment primary key, `migration` varchar(255) not null, `batch` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

我可以确认我所有的服务都已启动:

➜  laravel-adp-4 git:(develop) ✗ brew services list
Name Status User Plist
mysql started macbook /Users/macbook/Library/LaunchAgents/homebrew.mxcl.mysql.plist
mysql@5.7 started macbook /Users/macbook/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist
nginx started root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php started root /Library/LaunchDaemons/homebrew.mxcl.php.plist
php@7.3 started macbook /Users/macbook/Library/LaunchAgents/homebrew.mxcl.php@7.3.plist

在尝试排除故障时,我发现我无法再操作 mysql。当我尝试创建另一个数据库时,我看到以下错误:

ERROR 3680 (HY000): Failed to create schema directory 'alala' (errno: 2 - No such file or directory)

为什么我无法运行迁移?为什么我无法创建数据库?

最佳答案

您的查询不正确,您在 utf8mb4_unicode_ci 周围的单引号太多了

create table `migrations` (`id` int unsigned not null auto_increment primary key, `migration` varchar(255) not null, `batch` int not null) 
default character set utf8mb4 collate utf8mb4_unicode_ci

关于mysql - SQLSTATE[HY000] : General error: 1030 Got error 168 when running migrations,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64687918/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com