简体   繁体   中英

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

I have a fresh installation of laravel 7 which I installed through composer, created the database and connected in the .env. However, when I run migrations, I see the following error:

    ➜  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')

I can confirm that all my services are up:

➜  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

Trying to troubleshooting I noticed that I can no longer manipulate mysql. When I try to create another database, I see the following error:

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

Why am I not able to run migrations? Why am I not able to create a database?

Your query is nt ok you have a single quote too much around 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM