And*_*rio 6 php migrate database-migration laravel
我安装并打开了 XAMPP,这是我访问 phpmyadmin 页面的方式。我在 phpmyadmin 中创建了一个名为“firstdb”的数据库。
我还在本地存储的 Laravel 文件中创建了身份验证。我正在尝试使用 php artisan migrate 迁移表,但出现以下错误。
user@Andress-MacBook-Pro admin-panel % php artisan migrate
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firstdb and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
> 671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
+37 vendor frames
38 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Run Code Online (Sandbox Code Playgroud)
我到处找,请帮忙。
它可能是您.env文件中错误的 mysql 端口号。检查您的.env文件并确保端口号与 mysql 正在使用的相同。
我注意到命令行输出中的密码与 env 文件中实际的密码有些奇怪。结果我的密码中有一个数字符号,但它被切断了。
因此,在运行后检查输出php artisan migrate,并确保密码实际上与环境中的密码匹配(以及与此相关的所有信息)。解决方法是在不匹配的情况下添加引号。
DB_PASSWORD=abcdefghijklmonp5#Q
会成为
DB_PASSWORD='abcdefghijklmonp5#Q'
| 归档时间: |
|
| 查看次数: |
7890 次 |
| 最近记录: |