SQLSTATE HY000 1045 Access denied for user username localhost using CakePHP

0 votes

I'm new to CakePHP and PHP. While using CakePHP to wire my database, I keep running into issues.

I'm using the Bitnami 5.4.40-0 WAMP stack. I am building a web MVC application with CakePHP 3.0.4. My application configuration is shown below.

Entry for data sources in my app.php file.

/**
 * Connection information used by the ORM to connect
 * to your application's datastores.
 * Drivers include Mysql Postgres Sqlite Sqlserver
 * See vendor\cakephp\cakephp\src\Database\Driver for complete list
 */
'Datasources' => [
    'default' => [
        'className' => 'Cake\Database\Connection',
        'driver' => 'Cake\Database\Driver\Mysql',
        'persistent' => false,
        'host' => 'localhost',
        /**
         * CakePHP will use the default DB port based on the driver selected
         * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
         * the following line and set the port accordingly
         */
        //'port' => 'nonstandard_port_number',
        'username' => 'test2',
        'password' => 'computer',
        'database' => 'jobs',
        'encoding' => 'utf8',
        'timezone' => 'UTC',
        'cacheMetadata' => true,

        /**
         * Set identifier quoting to true if you are using reserved words or
         * special characters in your table or column names. Enabling this
         * setting will result in queries built using the Query Builder having
         * identifiers quoted when creating SQL. It should be noted that this
         * decreases performance because each query needs to be traversed and
         * manipulated before being executed.
         */
        'quoteIdentifiers' => false,

        /**
         * During development, if using MySQL < 5.6, uncommenting the
         * following line could boost the speed at which schema metadata is
         * fetched from the database. It can also be set directly with the
         * mysql configuration directive 'innodb_stats_on_metadata = 0'
         * which is the recommended value in production environments
         */
        //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
    ],

In accordance with CakePHP guidelines, I have previously built a database table called jobs. The root administrator and user test2 both have the same global privileges. But I'm receiving the following problem when I use the bake all command:

2015-07-01 06:24:56 Error: [PDOException] SQLSTATE[HY000] [1045] Access denied for user 'test2'@'localhost' (using password: YES)
Stack Trace:
C:\Bitnami\wampstack-5.4.40-0\apache2\htdocs\myjobs\vendor\cakephp\cakephp\src\Database\Driver\PDODriverTrait.php(48): PDO->__construct('mysql:host=127....', 'test2', 'computer', Array)
C:\Bitnami\wampstack-5.4.40-0\apache2\htdocs\myjobs\vendor\cakephp\cakephp\src\Database\Driver\Mysql.php(89): Cake\Database\Driver\Mysql->_connect('mysql:host=127....', Array)
C:\Bitnami\wampstack-5.4.40-0\apache2\htdocs\myjobs\vendor\cakephp\cakephp\src\Database\Schema\BaseSchema.php(46): Cake\Database\Driver\Mysql->connect()

Can someone please help me with this?

Aug 30, 2022 in Database by Kithuzzz
• 38,020 points
3,349 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Database

0 votes
1 answer

MySQL Error: : 'Access denied for user 'root'@'localhost'

Hello @kartik, I did this to set my ...READ MORE

answered May 4, 2020 in Database by Niroj
• 82,880 points
18,394 views
0 votes
0 answers

Access denied for user 'root@localhost' (using password:NO)

I wanted to run WordPress and it ...READ MORE

May 8, 2022 in Database by Kichu
• 19,050 points
1,613 views
0 votes
1 answer

Using Real Time flume Data for Analysis

By using MorphlineSolrSink we can extract, transform ...READ MORE

answered Jul 17, 2018 in Database by kurt_cobain
• 9,390 points
756 views
0 votes
1 answer

Access HFile without using Hbase

Yes, it's very much possible to access ...READ MORE

answered Aug 9, 2018 in Database by kurt_cobain
• 9,390 points
712 views
0 votes
0 answers

SQLException: No suitable Driver Found for jdbc:oracle:thin:@//localhost:1521/orcl

I'm attempting to create a Java EE ...READ MORE

Aug 15, 2022 in Database by Kithuzzz
• 38,020 points
689 views
0 votes
0 answers

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbname [duplicate]

I have this Java program: MySQLConnectExample.java import java.sql.*; import java.util.Properties; public ...READ MORE

Aug 21, 2022 in Database by Kithuzzz
• 38,020 points
2,156 views
0 votes
0 answers

PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client

I'm running MySQL version 8 on PHP ...READ MORE

Jun 18, 2022 in PHP by narikkadan
• 63,680 points
1,143 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
10,470 views
0 votes
1 answer

Why is not preferable to use mysql_* functions in PHP?

The reasons are as follows: The MySQL extension: Does ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,250 points
1,239 views
0 votes
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP