我正在关注Tutsplus上Laravel Essentails课程的实践项目。我在PagodaBox上创建了一个应用程序,并将其克隆到本地系统中。之后,我从https://github.com/JeffreyWay/Laravel-4-Generators安装了Laravel-4生成器,并为我的项目生成了资源:模型、视图、控制器、数据库种子等。
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' => '',
),当我检查‘homestead’@‘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机器。以前有没有人经历过这种情况。我不明白这里的错误是什么,我应该怎么做?
发布于 2014-07-04 06:50:57
查看创建的用户:
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.https://stackoverflow.com/questions/24097427
复制相似问题