迁移项目时出现错误

问题描述 投票:0回答:1

我尝试迁移项目但出现错误

php 工匠迁移

SQLSTATE[HY000] [1044] Access denied for user 'api'@'localhost' to database 'api' (Connection: mysql, SQL: select * from information_schema.tables where table_schema = api and table_name = migrations and table_type = 'BASE TABLE')

  at vendor\laravel\framework\src\Illuminate\Database\Connection.php:801
    797▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    798▕                 );
    799▕             }
    800▕
  ➜ 801▕             throw new QueryException(
    802▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    803▕             );
    804▕         }
    805▕     }

  1   vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:65
      PDOException::("SQLSTATE[HY000] [1044] Access denied for user 'api'@'localhost' to database 'api'")

  2   vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:65
      PDO::__construct()

使用 .env 中的登录名和密码连接到 mysql 正在工作

在 php.ini 中粘贴“extension=pdo_mysql”也不起作用

php mysql laravel laravel-artisan migrate
1个回答
0
投票

验证用户API:

  • 密码正确吗?
  • 用户拥有 schema api 和 information_schema 的权限?
© www.soinside.com 2019 - 2024. All rights reserved.