前提・実現したいこと????
ここに質問の内容を詳しく書いてください。
PHP(Laravel)でhttps://qiita.com/Fendo181/items/dece727ea402552fee19#link%E3%83%A2%E3%83%87%E3%83%AB%E3%82%92%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8Bを参考にプロジェクトを作っています。
php artisan migrateを実行後に以下のエラーメッセージが発生しました。
発生している問題・エラーメッセージ
vagrant@homestead:~/code/Sites/links$ php artisan migrate Illuminate\Database\QueryException SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE') at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671 667| // If an exception occurs when attempting to run a query, we'll format the error 668| // message to include the bindings with SQL, which will make this exception a 669| // lot more helpful to the developer instead of just the database's errors. 670| catch (Exception $e) { > 671| throw new QueryException( 672| $query, $this->prepareBindings($bindings), $e 673| ); 674| } 675| +34 vendor frames 35 artisan:37 Illuminate\Foundation\Console\Kernel::handle()
該当のソースコード
.env APP_NAME=Laravel APP_ENV=local APP_KEY= APP_DEBUG=true APP_URL=http:// LOG_CHANNEL=stack DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret
database.php 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ 'driver' => 'mysql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'homestead'), 'username' => env('DB_USERNAME', 'homestead'), 'password' => env('DB_PASSWORD', 'secret'), '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'), ]) : [], ],
vagrant@homestead:~/code/Sites/links$ mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.29-0ubuntu0.18.04.1 (Ubuntu) Copyright (c) 2000, 2020, 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> SELECT Host, User, authentication_string FROM mysql.user; +-----------+------------------+-------------------------------------------+ | Host | User | authentication_string | +-----------+------------------+-------------------------------------------+ | localhost | root | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 | | localhost | mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | localhost | mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | | localhost | debian-sys-maint | *203166D67D9C788D2D5818D78CACCEBC859C8338 | | 0.0.0.0 | root | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 | | 0.0.0.0 | homestead | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 | | % | homestead | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 | | 127.0.0.1 | forge | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 | | 127.0.0.1 | homestead | *14E65567ABDB5135D0CFD9A70B3032C179A49EE7 | +-----------+------------------+-------------------------------------------+ 9 rows in set (0.01 sec) mysql> show databases; +---------------------+ | Database | +---------------------+ | information_schema | | DB_NAME | | homestead | | #mysql50#lost+found | | mysql | | performance_schema | | sys | +---------------------+ 7 rows in set (0.04 sec) mysql>
試したこと
mysqlにてパスワードをセット。?
.envとdatabase.phpの見比べ、見直し。
不安なため、権限付きユーザーを複数登録。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
プログラミング初心者かつ、初質問なので不備が多々あるとは存じますが
何卒宜しくお願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。