環境
Mac OSX
MAMP
・ MySQL:3306
・Apache:80
laravelでmigrationファイルを作成し、MAMP経由で接続したphpMyAdminにmybbsというデータベースを作成後、migrateしました。
php artisan migrate
その結果以下のエラーが発生しました。
Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = mybbs and table_name = migrations) at /Applications/MAMP/htdocs/bbs/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| Exception trace: 1 PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)") /Applications/MAMP/htdocs/bbs/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70 2 PDO::__construct("mysql:unix_socket=/tmp/mysql.sock;dbname=mybbs", "root", "secret", []) /Applications/MAMP/htdocs/bbs/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70 Please use the argument -v to see more details.
localhostへの接続が拒否されているのでしょうか?
.envファイルは以下の設定です
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=mybbs DB_USERNAME=root DB_PASSWORD=secret
わかる方教えていただけると嬉しいです。

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。