- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在设置 Laravel 环境。所以,我下载了 XAMPP 并相应地配置了我的 vhost 文件。然后,我设置 MySQL 并运行以下命令:
运行第 4 次后,我在图片中得到以下错误。
C:\Users\Aslam\Desktop\Pfera_application\pfera-web>php artisan migrate -v
Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = forge and table_name = migrations)
at C:\Users\Aslam\Desktop\Pfera_application\pfera-web\vendor\laravel\framework\src\Illuminate\Database\Connection.php: 664
660: // If an exception occurs when attempting to run a query, we'll format the error
661: // message to include the bindings with SQL, which will make this exception a
662: // lot more helpful to the developer instead of just the database's errors.
663: catch (Exception $e) {
664: throw new QueryException(
665: $query, $this->prepareBindings($bindings), $e
666: );
667: }
668:
669: return $result;
Exception trace:
1 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: YES)")
C:\Users\Aslam\Desktop\Pfera_application\pfera-web\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php : 50
求助!!!非常感谢!
PS,这里是database.php文件:
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
];
这是我的 .env 文件:
## REAL KEY REMOVED FOR PLAIN TEXT TRANSFER
## SEE http://laravel-recipes.com/recipes/283/generating-a-new-application-key FOR GENERATING YOUR OWN KEY, DO THIS BEFORE RUNNING ANY SEEDS
APP_NAME=Pfera
APP_ENV=staging
APP_KEY=base64:E8vEONwbkikyy/7IsRpNg/kakuRy3/JCUjetkpH1EzE=
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_URL=pfera.local
## THESE ARE DB CREDS THAT ARE SPECIFIC TO YOUR OWN DATABASE
## REAL PASSWORD REMOVED FOR PLAIN TEXT TRANSFER
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=password
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
## REAL MAILGUN SECRET REMOVED FOR PLAINT TEXT TRANSFER
## THIS IS FOR CODE AND MORTAR'S DEVELOPMENT ACCOUNT, UNIQUE CREDENTIALS WILL
## NEED TO BE CREATED FROM YOUR OWN ACCOUNT FOR PRODUCTION, LOCAL DEVELOPMENT,
## AND ONCE THE STAGING ENVIRONMENT IS FULLY TRANSITIONED
MAIL_DRIVER=mailgun
MAILGUN_DOMAIN=mg.codeandmortar.com
MAILGUN_SECRET=12345678
MAIL_FROM_NAME="Pfera"
MAIL_FROM_ADDRESS="no-reply@pfera.ca"
MAIL_FROM="no-reply@pfera.ca"
## THESE ARE ALL VARIABLES FOR SPARK FEATURES NOT IMPLEMENTED IN THIS PHASE
PUSHER_KEY=
PUSHER_SECRET=
PUSHER_APP_ID=
AUTHY_SECRET=
STRIPE_MODEL=App\User
STRIPE_KEY=
STRIPE_SECRET=
BRAINTREE_MODEL=App\User
BRAINTREE_ENV=
BRAINTREE_MERCHANT_ID=
BRAINTREE_KEY=
BRAINTREE_SECRET=
## END NON-IMPLEMENTED SPARK VARIABLES
## PAGINATION
HORSES_PER_PAGE=20
EVENTS_PER_PAGE=20
TESTS_PER_PAGE=20
USERS_PER_PAGE=20
## ESTIMATED ESTROUS CYCLE LENGTH IN DAYS
ESTROUS_CYCLE=21
## VARIABLES THE POINT OUT:
## 1) THE PATH TO THE `Rscript` EXECUTABLE TO RUN R CODE
## 2) THE PATH TO THE R CODE REPO
## 3) THE FILENAME OF THE R CODE TO RUN
## NOTE THAT ON THE SERVER WE'RE USING `chroot` SINCE THE R AND PHP UBUNTU
## BINARIES HAD CONFLICTING DEPENDENCIES, THIS IS WHY THE "RELATIVE" PATH FOR
## THE R SCRIPT IS JUST `.`, BECAUSE IT IS WITHIN THE ROOT OF THE CHROOT JAIL.
## THIS WILL ALMOST DEFINITELY NOT BE THE CASE IN LOCAL DEVELOPMENT. FOR LOCAL
## DEVELOPMENT, I WOULD STRONGLY RECOMMEND PROVING `R_PREDICT_PATH` A FULL PATH
## TO THE DIRECTORY THAT CONTAINS THE R CODE (THIS PATH MUST NOT INCLUDE THE R
## FILE ITSELF)
RSCRIPT_BIN="chroot /var/chroot Rscript"
R_PREDICT_PATH=/c/Users/Aslam/Desktop/Pfera_application/pfera-r
R_PREDICT_FILE=predict.R
最佳答案
这是一个连接错误,如果你确定你的数据库用户和密码然后尝试在 cli 中退出你的 artisan 服务器并重新运行
php artisan serve
如果您不确定您的用户名或密码,并且您正在使用带有 vagrant 的 homestead
尝试以下操作
DB_DATABASE=forge
DB_USERNAME=homestead
DB_PASSWORD=secret
如果您不确定自己的密码和用户名并且没有使用 vagrant homestead
试试这个
DB_DATABASE=forge
DB_USERNAME=root
DB_PASSWORD=
关于php - artisan 迁移访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50745921/
在全新的 Laravel 安装中,我正在运行 php artisan migrate 并且它正在返回: [Illuminate\Database\QueryException]
是否可以为 创建 Artisan 调用或命令 php artisan migrate 喜欢 Artisan::call('migrate); 因此,当连接动态更改时,我可以将丢失的表迁移到我的数据库。
我想创建一个别名,例如 php artisan go 而不是 php artisan 服务 我会感激任何其他想法:-)。我也读过这篇文章link并搜索了很多,但不太清楚,其他问题是关于制作 class
我在 Horizon 中使用 Laravel 队列和 Redis。Supervisor 正在运行 artisan horizon,它会生成进程 /usr/bin/php7.2 artisan
我在内核命令中工作,我需要更改旧命令: 旧命令是: php artisan crawl:author 现在我需要将其重命名为: php artisan crawl-bq:author 在我的命令文件签
我决定测试新的 Laravel。所以我从基本命令开始: $ laravel new blog $ php artisan make:auth $ php artisan migrate 我编辑了 Ap
在 Laravel 中注意到有两种方法可以清除缓存 php artisan cache:clear 和 php artisan config:cache 但是我意识到只有第二个在更改本地化、添加 la
我正在做一个 Lumen 项目。 我尝试使用 Artisan::call('my-command') 但是 PHP 说我没有定义 Artisan 类。 我已经使用以下命令启用了 Facade: $ap
那么 php artisan serve 到底在做什么呢?我目前有一个在 apache 上运行的站点,我正在尝试建立一个 websocket 框架以进行实时聊天。 websocket是一个后台运行的p
通常我会运行像这样的 laravel artisan 命令 php artisan Command -v 如果出现错误,我可以使用 -v 标志找到文件/行号。 出于某种原因,-v 不适用于我的命令之一
主表 POll public function up() { Schema::create('poll', function (Blueprint $table) {
您好,我在使用 php artisan migrate 在我的 vps 服务器上进行迁移时遇到问题。我已经安装了apache2和mysql。我可以通过 mysql -u root -p 使用密码“pa
由于某种原因,每当我运行任何 php artisan 命令时,我都会收到一条错误消息,指出我的一个表不存在。这是真的,我正在开始一个新的数据库。我不明白的是, artisan 到底为什么需要使用这张
我正在设置 Laravel 环境。所以,我下载了 XAMPP 并相应地配置了我的 vhost 文件。然后,我设置 MySQL 并运行以下命令: Composer 安装 npm 安装 php artis
我在我的 Mac 上运行本地 MAMP 机器。 Laravel 在生产环境中运行。 Laravel 能够在我通过浏览器显示的 php 页面上访问 MySQL 数据库,但是当我在终端中运行 php ar
我已经将我的 Laravel 5.5 项目上传到 centOS7 服务器。现在,当我第一次运行“php artisan migrate”加载数据库表时,我遇到了以下错误。 Error message
我正在运行一个基本的 artisan command test但是 phpunit 提示 This test did not perform any assertion。但是我断言了退出代码。 pub
我正在 Azure 上运行 Laravel 应用程序。事情正在朝着正确的方向发展,composer install 根本不起作用。然而现在,“php artisan optimize”命令超时了: 但
当我尝试运行 artisan 命令 php artisan route:list 时出现以下错误: [Symfony\Component\Debug\Exception\FatalErrorExcep
今天我遇到了一个我以前从未遇到过的非常奇怪的情况,而且在任何地方都找不到解决办法。 每当我在控制台中键入 php artisan 时,它都不会返回任何内容。尝试多次克隆 repo(在此处的其他机器上运
我是一名优秀的程序员,十分优秀!