【问题标题】:migrations file are not being created in laravel未在 laravel 中创建迁移文件
【发布时间】:2017-05-01 04:59:25
【问题描述】:

我正在尝试在我的数据库上创建一个用户表,我输入 composer:

C:\Users\Dell\proTest>php artisan make:migration users                                                             
Created Migration: 2017_04_30_195825_users                                                                                                                                                                                                                                                                                                                                                                 

我的 .env 文件数据库、数据库用户名和密码与我在本地主机上创建的数据库相同,与 database.php 文件相同。

问题是它说迁移已经创建,但是当我继续我的 laravel 项目文件数据库/迁移时,我找不到文件?

我已经尝试用谷歌搜索这个问题几个小时了,我确实清除了项目缓存,我确实创建了一个新项目仍然无法正常工作!有什么建议吗?

当我运行 php aritsan migrate 时出现此错误

    [Illuminate\Database\QueryException]
  SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrat
  ions)

[Illuminate\Database\QueryException]
  SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrat
  ions)

【问题讨论】:

  • 你的项目路径是什么?

标签: php database laravel migration


【解决方案1】:

如果 .env 文件和 database.php 上的数据库信息相同。我很确定您的 laravel 路径与编辑器的路径不同。

【讨论】:

    【解决方案2】:

    运行:

    C:\Users\Dell\proTes php artisan migrate
    

    迁移文件可以在这里:

    C:\Users\Dell\proTes\database\migrations
    

    【讨论】:

    • @trance_le 为用户 homestead 授予权限或在 .env DB 配置中使用 root 用户;还要确保目录数据库/迁移对于 CLI 用户是可写的
    猜你喜欢
    • 2013-09-26
    • 2017-07-02
    • 2018-10-26
    • 2019-12-05
    • 2023-01-04
    • 2021-06-23
    • 2016-12-27
    • 1970-01-01
    • 2019-05-17
    相关资源
    最近更新 更多