【发布时间】:2021-04-08 21:41:42
【问题描述】:
我在 MAC 上使用 Laravel Framework 8.20.1 & XAMPP For MySQL Database,当我运行这个命令时: php artisan migrate 它显示一条错误消息,不知道为什么?
.env:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=atamana_db
DB_USERNAME=root
DB_PASSWORD=
错误:
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = atamana_db and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
674▕ // If an exception occurs when attempting to run a query, we'll format the error
675▕ // message to include the bindings with SQL, which will make this exception a
676▕ // lot more helpful to the developer instead of just the database's errors.
677▕ catch (Exception $e) {
➜ 678▕ throw new QueryException(
679▕ $query, $this->prepareBindings($bindings), $e
680▕ );
681▕ }
682▕
+33 vendor frames
34 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
【问题讨论】:
-
php artisan migrate:fresh有效吗?小心 - 这会回滚您的所有迁移并再次应用它们 -
之前已经尝试过这两种解决方案,但它根本不起作用。这是一个全新的测试安装项目,所以我不介意回滚任何东西
-
我已经根据这篇文章安装和配置了 MySQL 但还是同样的问题medium.com/macoclock/mysql-on-mac-getting-started-cecb65b78e