laravelでlaravel/uiライブラリをインストールしました。
そして新規登録、login機能を実装しようとしていますが
mysqlのデーターベースとうまく紐づいてないようです。
ご教授お願いします。
mysqlのログインはできていると思います。
$ mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 59 Server version: 5.6.43 Homebrew Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> CREATE USER 'test_user'@'%' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.03 sec) mysql> GRANT ALL ON shop.* TO 'test_user'@'%'; Query OK, 0 rows affected (0.00 sec) mysql> Ctrl-C -- exit! Aborted $ php artisan config:cache Configuration cache cleared! Configuration cached successfully! $ php artisan make:migration create_posts_table Created Migration: 2020_02_23_230013_create_posts_table $ php artisan migrate Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'test_user'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = shop and table_name = migrations and table_type = 'BASE TABLE') at /Users/MISIAN/projects/shop/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669 665| // If an exception occurs when attempting to run a query, we'll format the error 666| // message to include the bindings with SQL, which will make this exception a 667| // lot more helpful to the developer instead of just the database's errors. 668| catch (Exception $e) { > 669| throw new QueryException( 670| $query, $this->prepareBindings($bindings), $e 671| ); 672| } 673| Exception trace: 1 PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'test_user'@'localhost' (using password: YES)") /Users/MISIAN/projects/shop/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70 2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=shop", "test_user", "123456", []) /Users/MISIAN/projects/shop/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70 Please use the argument -v to see more details.
```.env DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=shop DB_USERNAME=test_user DB_PASSWORD=123456
ファイル名 config/database.php 'mysql' => [ 'driver' => 'mysql', 'url' => env('DATABASE_URL'), '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' => '', 'prefix_indexes' => true, 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ],
回答1件
あなたの回答
tips
プレビュー