mysql - SQLSTATE [HY000]:一般错误:1030 运行迁移时出现错误 168
问题描述
我通过composer安装了全新的laravel 7,创建了数据库并连接到.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
推荐阅读
- html - 害怕 CSS 会被其他 css 文件覆盖
- swift - Swift:复制 UInt32 缓冲区的最快方法
- c++ - SDL/C++:如何平滑但随机地移动矩形?
- angular - 没有 detectChanges 测试 observables 失败
- javascript - onUserLocationChange 更改 React Native Maps 区域
- php - TicTacToe 对角检查功能
- outlook - Outlook 加载项:Outlook 横向加载项视图是否存在?
- javascript - 表单字段中的切换图标
- typescript - 从 TypeScript 中的数据库枚举
- vba - .End(xlUp) 可以跳过 Excel 表格数据范围底部的空白行/单元格吗?