###前提・実現したいこと
PHP(CakePHP)でweb顧客管理システムを作っています。
ローカル環境にてMYSQLに接続しようとすると以下のエラーメッセージが発生しました。
###発生している問題・エラーメッセージ
Error: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) If you are using SQL keywords as table column names, you can enable identifier quoting for your database connection in config/app.php. If you want to customize this error message, create src\Template\Error\pdo_error.ctp
###configディレクトリ内のapp.phpのソースコード
'Datasources' => [ 'default' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', //'port' => 'non_standard_port_number', 'username' => 'root', 'password' => '1234', 'database' => 'dealer_id000', 'encoding' => 'utf8', 'timezone' => 'UTC', 'flags' => [], 'cacheMetadata' => true, 'log' => false, 'quoteIdentifiers' => false, //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], 'url' => env('DATABASE_URL', null), ], 'master' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', //'port' => 'non_standard_port_number', 'username' => 'hoge', 'password' => '9876', 'database' => 'master', 'encoding' => 'utf8', 'timezone' => 'UTC', 'flags' => [], 'cacheMetadata' => true, 'log' => false, 'quoteIdentifiers' => false, //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], 'url' => env('DATABASE_URL', null), ], 'test' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', //'port' => 'non_standard_port_number', 'username' => 'my_app', 'password' => '5678', 'database' => 'test_myapp', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => true, 'quoteIdentifiers' => false, 'log' => false, //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], 'url' => env('DATABASE_TEST_URL', null), ], 'dealer_id000' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', //'port' => 'non_standard_port_number', 'username' => 'root', 'password' => '1234', 'database' => 'dealer_id000', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => true, 'quoteIdentifiers' => false, 'log' => false, //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], 'url' => env('DATABASE_TEST_URL', null), ], 'dealer_id001' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', //'port' => 'non_standard_port_number', 'username' => 'hoge', 'password' => '9876', 'database' => 'dealer_id001', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => true, 'quoteIdentifiers' => false, 'log' => false, //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], 'url' => env('DATABASE_TEST_URL', null), ], 'dealer_id002' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', //'port' => 'non_standard_port_number', 'username' => 'root', 'password' => '1234', 'database' => 'dealer_id002', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => true, 'quoteIdentifiers' => false, 'log' => false, //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], 'url' => env('DATABASE_TEST_URL', null), ], 'cakephp2' => [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Mysql', 'persistent' => false, 'host' => 'localhost', //'port' => 'non_standard_port_number', 'username' => 'root', 'password' => '1234', 'database' => 'cakephp2', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => true, 'quoteIdentifiers' => false, 'log' => false, //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], 'url' => env('DATABASE_TEST_URL', null), ], ],
###試したこと
root@localhostで接続されないとのことなので、パスワードを変更して試したりなど行いました。
###補足情報(言語/FW/ツール等のバージョンなど)
Cakephp3
mysql Ver 15.1 Distrib 10.1.26-MariaDB, for Win32 (AMD64)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/11/09 00:14
2017/11/09 02:01
2017/11/09 02:06
2017/11/09 02:10
2017/11/09 02:12
2017/11/09 06:10