我跟随Tutsplus上Laravel Essentails的实践项目。我在PagodaBox上创建了一个应用程序并将其克隆到我的本地系统中。之后,我从https://github.com/JeffreyWay/Laravel-4-Generators安装Laravel-4-Generator并为我的项目生成资源:模型,视图,控制器,数据库种子等。 接下来,我尝试运行
php artisan migrate:install snippets
但是我收到了以下错误:
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
我不知道这里的家园用户是什么。 这是我的项目的数据库文件
'default' => 'mysql',
'connections' => array(
'sqlite' => array(
'driver' => 'sqlite',
'database' => __DIR__.'/../database/production.sqlite',
'prefix' => '',
),
'mysql' => array(
'driver' => 'mysql',
'host' => isset($_SERVER['DB1_HOST']) ? $_SERVER['DB1_HOST'] : 'localhost',
'database' => isset($_SERVER['DB1_NAME']) ? $_SERVER['DB1_NAME'] : 'snippets',
'username' => isset($_SERVER['DB1_USER']) ? $_SERVER['DB1_USER'] : 'root',
'password' => isset($_SERVER['DB1_PASS']) ? $_SERVER['DB1_PASS'] : '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
这是我检查“宅基地”的资助时的结果' localhost':
mysql> SHOW GRANTS FOR 'homestead'@'localhost';
+---------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for homestead@localhost |
+---------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'homestead'@'localhost' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8.......F' WITH GRANT OPTION |
+---------------------------------------------------------------------------------------------------------------------------------------------+
P / S:我在mysql中创建了片段数据库,我在Ubuntu 14.04机器上创建了片段数据库。 有谁之前经历过这个吗。我该怎么办,因为我不明白这里的错误是什么。
答案 0 :(得分:0)
查看已创建的用户:
mysql> select user,host from mysql.user;
+------+----------------------+
| user | host |
+------+----------------------+
| root | % |
| root | 127.0.0.1 |
| root | ::1 |
| root | imac.de.yadira.local |
| | localhost |
| root | localhost |
| | mor-mac.local |
+------+----------------------+
7 rows in set (0.00 sec)
复制imac.de.yadira.local并在我的情况下替换主机名它是mor-mac.local
$env = $app->detectEnvironment(array(
'local' => array('imac.de.yadira.local'),
));
现在运行:
mor-mac:resposive yadira$ php artisan migrate:install
Migration table created successfully.