cakephp error. Connection to database …not …: Access denied for user 'my_app'@'localhost' (using password: YES)
up vote
3
down vote
favorite
I am trying to start CakePHP. I made bookmarker and tested by command bincake server
. It showed one error as connection to database could not be established:
SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost' (using password: YES).
I read the config/app.default.php
file. It says there is a database my_app
and another database test_myapp
with some users. I can not find these databases in phymyadmin in xampp. Am I supposed to create the named databases and users manually? I thought CakePHP should create these automatically. Or should I give names of databases etc. which I like and create the same.I'm using xampp with windows 7 and am very new to CakePHP.
database cakephp default cakephp-3.0
add a comment |
up vote
3
down vote
favorite
I am trying to start CakePHP. I made bookmarker and tested by command bincake server
. It showed one error as connection to database could not be established:
SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost' (using password: YES).
I read the config/app.default.php
file. It says there is a database my_app
and another database test_myapp
with some users. I can not find these databases in phymyadmin in xampp. Am I supposed to create the named databases and users manually? I thought CakePHP should create these automatically. Or should I give names of databases etc. which I like and create the same.I'm using xampp with windows 7 and am very new to CakePHP.
database cakephp default cakephp-3.0
test_myapp is a test database setup by cakephp itself
– Keyur Padalia
May 14 '15 at 15:46
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I am trying to start CakePHP. I made bookmarker and tested by command bincake server
. It showed one error as connection to database could not be established:
SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost' (using password: YES).
I read the config/app.default.php
file. It says there is a database my_app
and another database test_myapp
with some users. I can not find these databases in phymyadmin in xampp. Am I supposed to create the named databases and users manually? I thought CakePHP should create these automatically. Or should I give names of databases etc. which I like and create the same.I'm using xampp with windows 7 and am very new to CakePHP.
database cakephp default cakephp-3.0
I am trying to start CakePHP. I made bookmarker and tested by command bincake server
. It showed one error as connection to database could not be established:
SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost' (using password: YES).
I read the config/app.default.php
file. It says there is a database my_app
and another database test_myapp
with some users. I can not find these databases in phymyadmin in xampp. Am I supposed to create the named databases and users manually? I thought CakePHP should create these automatically. Or should I give names of databases etc. which I like and create the same.I'm using xampp with windows 7 and am very new to CakePHP.
database cakephp default cakephp-3.0
database cakephp default cakephp-3.0
edited May 17 '15 at 5:23
Mureinik
176k21127195
176k21127195
asked May 14 '15 at 12:43
Ajay Dhar
26113
26113
test_myapp is a test database setup by cakephp itself
– Keyur Padalia
May 14 '15 at 15:46
add a comment |
test_myapp is a test database setup by cakephp itself
– Keyur Padalia
May 14 '15 at 15:46
test_myapp is a test database setup by cakephp itself
– Keyur Padalia
May 14 '15 at 15:46
test_myapp is a test database setup by cakephp itself
– Keyur Padalia
May 14 '15 at 15:46
add a comment |
3 Answers
3
active
oldest
votes
up vote
5
down vote
accepted
Cake will not create the database or database user for you. You need to create them yourself and then match these database credentials into the db config file. Your datasource in app/Config/app.php
file should look something similar to:
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'my_db_user',
'password' => 'my_db_user_password',
'database' => 'cake_database_name',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
]
],
In this example you would have to create a database named: cake_database_name, and then add a database user named my_db_user with the password of my_db_user_password.
1
Thanks a lot McWayWeb, specially for the detailed way you answered. You make it very simple. You judged my level of ability accurately and gave a simple explaination!
– Ajay Dhar
May 15 '15 at 9:15
1
I added a database for cake and another for test. I created a user also with a few priviliages. I changed the values in config.app.php as per the 2 databases I created. Still bincake server command gives the error Access denied for user 'my_app'@'localhost' (using password: YES). It should not even use the name 'my_app' since I changed it in config/app.php but it persists. Please help.
– Ajay Dhar
May 19 '15 at 13:19
I also make 4 tables in the first database as advised by cake docs.
– Ajay Dhar
May 19 '15 at 13:44
I got it now. I was editing the wrong app.php. I now edited the higher app.php and it is working nicely. It connects to the database. I am so happy. Thanks a lot.
– Ajay Dhar
May 19 '15 at 13:53
how to mark your answer as the right one and best?
– Ajay Dhar
May 19 '15 at 14:00
|
show 1 more comment
up vote
1
down vote
See in Mysql.php:
class Mysql extends Driver
{
use MysqlDialectTrait;
use PDODriverTrait;
/**
* Base configuration settings for MySQL driver
*
* @var array
*/
protected $_baseConfig = [
'persistent' => true,
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'cake',
'port' => '3306',
'flags' => ,
'encoding' => 'utf8',
'timezone' => null,
'init' => ,
];
Then in app.php write
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'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' => 'non_standard_port_number',
'username' => 'root',
'password' => '',
'database' => 'cake',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => ,
'cacheMetadata' => true,
'log' => false,
...],
In phpMyAdmin
create cake database.
It's all.
add a comment |
up vote
0
down vote
Error:
SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost'
(using password: YES).
Reason:
No user id: "my_app" with password: "secret" [or any other] set in config/app.php
file.
Solution:
In case of WAMP, go to phpmyadmin page, then we can select cake_cms
database -> privilage-> create user id and password, same as in config
file config/app.php, refresh the http://localhost:8765/ page.
it should now show
CakePHP is able to connect to the database.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
Cake will not create the database or database user for you. You need to create them yourself and then match these database credentials into the db config file. Your datasource in app/Config/app.php
file should look something similar to:
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'my_db_user',
'password' => 'my_db_user_password',
'database' => 'cake_database_name',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
]
],
In this example you would have to create a database named: cake_database_name, and then add a database user named my_db_user with the password of my_db_user_password.
1
Thanks a lot McWayWeb, specially for the detailed way you answered. You make it very simple. You judged my level of ability accurately and gave a simple explaination!
– Ajay Dhar
May 15 '15 at 9:15
1
I added a database for cake and another for test. I created a user also with a few priviliages. I changed the values in config.app.php as per the 2 databases I created. Still bincake server command gives the error Access denied for user 'my_app'@'localhost' (using password: YES). It should not even use the name 'my_app' since I changed it in config/app.php but it persists. Please help.
– Ajay Dhar
May 19 '15 at 13:19
I also make 4 tables in the first database as advised by cake docs.
– Ajay Dhar
May 19 '15 at 13:44
I got it now. I was editing the wrong app.php. I now edited the higher app.php and it is working nicely. It connects to the database. I am so happy. Thanks a lot.
– Ajay Dhar
May 19 '15 at 13:53
how to mark your answer as the right one and best?
– Ajay Dhar
May 19 '15 at 14:00
|
show 1 more comment
up vote
5
down vote
accepted
Cake will not create the database or database user for you. You need to create them yourself and then match these database credentials into the db config file. Your datasource in app/Config/app.php
file should look something similar to:
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'my_db_user',
'password' => 'my_db_user_password',
'database' => 'cake_database_name',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
]
],
In this example you would have to create a database named: cake_database_name, and then add a database user named my_db_user with the password of my_db_user_password.
1
Thanks a lot McWayWeb, specially for the detailed way you answered. You make it very simple. You judged my level of ability accurately and gave a simple explaination!
– Ajay Dhar
May 15 '15 at 9:15
1
I added a database for cake and another for test. I created a user also with a few priviliages. I changed the values in config.app.php as per the 2 databases I created. Still bincake server command gives the error Access denied for user 'my_app'@'localhost' (using password: YES). It should not even use the name 'my_app' since I changed it in config/app.php but it persists. Please help.
– Ajay Dhar
May 19 '15 at 13:19
I also make 4 tables in the first database as advised by cake docs.
– Ajay Dhar
May 19 '15 at 13:44
I got it now. I was editing the wrong app.php. I now edited the higher app.php and it is working nicely. It connects to the database. I am so happy. Thanks a lot.
– Ajay Dhar
May 19 '15 at 13:53
how to mark your answer as the right one and best?
– Ajay Dhar
May 19 '15 at 14:00
|
show 1 more comment
up vote
5
down vote
accepted
up vote
5
down vote
accepted
Cake will not create the database or database user for you. You need to create them yourself and then match these database credentials into the db config file. Your datasource in app/Config/app.php
file should look something similar to:
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'my_db_user',
'password' => 'my_db_user_password',
'database' => 'cake_database_name',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
]
],
In this example you would have to create a database named: cake_database_name, and then add a database user named my_db_user with the password of my_db_user_password.
Cake will not create the database or database user for you. You need to create them yourself and then match these database credentials into the db config file. Your datasource in app/Config/app.php
file should look something similar to:
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'my_db_user',
'password' => 'my_db_user_password',
'database' => 'cake_database_name',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
]
],
In this example you would have to create a database named: cake_database_name, and then add a database user named my_db_user with the password of my_db_user_password.
edited May 14 '15 at 21:21
answered May 14 '15 at 20:24
McWayWeb
1,01411329
1,01411329
1
Thanks a lot McWayWeb, specially for the detailed way you answered. You make it very simple. You judged my level of ability accurately and gave a simple explaination!
– Ajay Dhar
May 15 '15 at 9:15
1
I added a database for cake and another for test. I created a user also with a few priviliages. I changed the values in config.app.php as per the 2 databases I created. Still bincake server command gives the error Access denied for user 'my_app'@'localhost' (using password: YES). It should not even use the name 'my_app' since I changed it in config/app.php but it persists. Please help.
– Ajay Dhar
May 19 '15 at 13:19
I also make 4 tables in the first database as advised by cake docs.
– Ajay Dhar
May 19 '15 at 13:44
I got it now. I was editing the wrong app.php. I now edited the higher app.php and it is working nicely. It connects to the database. I am so happy. Thanks a lot.
– Ajay Dhar
May 19 '15 at 13:53
how to mark your answer as the right one and best?
– Ajay Dhar
May 19 '15 at 14:00
|
show 1 more comment
1
Thanks a lot McWayWeb, specially for the detailed way you answered. You make it very simple. You judged my level of ability accurately and gave a simple explaination!
– Ajay Dhar
May 15 '15 at 9:15
1
I added a database for cake and another for test. I created a user also with a few priviliages. I changed the values in config.app.php as per the 2 databases I created. Still bincake server command gives the error Access denied for user 'my_app'@'localhost' (using password: YES). It should not even use the name 'my_app' since I changed it in config/app.php but it persists. Please help.
– Ajay Dhar
May 19 '15 at 13:19
I also make 4 tables in the first database as advised by cake docs.
– Ajay Dhar
May 19 '15 at 13:44
I got it now. I was editing the wrong app.php. I now edited the higher app.php and it is working nicely. It connects to the database. I am so happy. Thanks a lot.
– Ajay Dhar
May 19 '15 at 13:53
how to mark your answer as the right one and best?
– Ajay Dhar
May 19 '15 at 14:00
1
1
Thanks a lot McWayWeb, specially for the detailed way you answered. You make it very simple. You judged my level of ability accurately and gave a simple explaination!
– Ajay Dhar
May 15 '15 at 9:15
Thanks a lot McWayWeb, specially for the detailed way you answered. You make it very simple. You judged my level of ability accurately and gave a simple explaination!
– Ajay Dhar
May 15 '15 at 9:15
1
1
I added a database for cake and another for test. I created a user also with a few priviliages. I changed the values in config.app.php as per the 2 databases I created. Still bincake server command gives the error Access denied for user 'my_app'@'localhost' (using password: YES). It should not even use the name 'my_app' since I changed it in config/app.php but it persists. Please help.
– Ajay Dhar
May 19 '15 at 13:19
I added a database for cake and another for test. I created a user also with a few priviliages. I changed the values in config.app.php as per the 2 databases I created. Still bincake server command gives the error Access denied for user 'my_app'@'localhost' (using password: YES). It should not even use the name 'my_app' since I changed it in config/app.php but it persists. Please help.
– Ajay Dhar
May 19 '15 at 13:19
I also make 4 tables in the first database as advised by cake docs.
– Ajay Dhar
May 19 '15 at 13:44
I also make 4 tables in the first database as advised by cake docs.
– Ajay Dhar
May 19 '15 at 13:44
I got it now. I was editing the wrong app.php. I now edited the higher app.php and it is working nicely. It connects to the database. I am so happy. Thanks a lot.
– Ajay Dhar
May 19 '15 at 13:53
I got it now. I was editing the wrong app.php. I now edited the higher app.php and it is working nicely. It connects to the database. I am so happy. Thanks a lot.
– Ajay Dhar
May 19 '15 at 13:53
how to mark your answer as the right one and best?
– Ajay Dhar
May 19 '15 at 14:00
how to mark your answer as the right one and best?
– Ajay Dhar
May 19 '15 at 14:00
|
show 1 more comment
up vote
1
down vote
See in Mysql.php:
class Mysql extends Driver
{
use MysqlDialectTrait;
use PDODriverTrait;
/**
* Base configuration settings for MySQL driver
*
* @var array
*/
protected $_baseConfig = [
'persistent' => true,
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'cake',
'port' => '3306',
'flags' => ,
'encoding' => 'utf8',
'timezone' => null,
'init' => ,
];
Then in app.php write
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'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' => 'non_standard_port_number',
'username' => 'root',
'password' => '',
'database' => 'cake',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => ,
'cacheMetadata' => true,
'log' => false,
...],
In phpMyAdmin
create cake database.
It's all.
add a comment |
up vote
1
down vote
See in Mysql.php:
class Mysql extends Driver
{
use MysqlDialectTrait;
use PDODriverTrait;
/**
* Base configuration settings for MySQL driver
*
* @var array
*/
protected $_baseConfig = [
'persistent' => true,
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'cake',
'port' => '3306',
'flags' => ,
'encoding' => 'utf8',
'timezone' => null,
'init' => ,
];
Then in app.php write
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'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' => 'non_standard_port_number',
'username' => 'root',
'password' => '',
'database' => 'cake',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => ,
'cacheMetadata' => true,
'log' => false,
...],
In phpMyAdmin
create cake database.
It's all.
add a comment |
up vote
1
down vote
up vote
1
down vote
See in Mysql.php:
class Mysql extends Driver
{
use MysqlDialectTrait;
use PDODriverTrait;
/**
* Base configuration settings for MySQL driver
*
* @var array
*/
protected $_baseConfig = [
'persistent' => true,
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'cake',
'port' => '3306',
'flags' => ,
'encoding' => 'utf8',
'timezone' => null,
'init' => ,
];
Then in app.php write
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'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' => 'non_standard_port_number',
'username' => 'root',
'password' => '',
'database' => 'cake',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => ,
'cacheMetadata' => true,
'log' => false,
...],
In phpMyAdmin
create cake database.
It's all.
See in Mysql.php:
class Mysql extends Driver
{
use MysqlDialectTrait;
use PDODriverTrait;
/**
* Base configuration settings for MySQL driver
*
* @var array
*/
protected $_baseConfig = [
'persistent' => true,
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'cake',
'port' => '3306',
'flags' => ,
'encoding' => 'utf8',
'timezone' => null,
'init' => ,
];
Then in app.php write
'Datasources' => [
'default' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'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' => 'non_standard_port_number',
'username' => 'root',
'password' => '',
'database' => 'cake',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => ,
'cacheMetadata' => true,
'log' => false,
...],
In phpMyAdmin
create cake database.
It's all.
answered May 2 '16 at 12:36
user6281223
111
111
add a comment |
add a comment |
up vote
0
down vote
Error:
SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost'
(using password: YES).
Reason:
No user id: "my_app" with password: "secret" [or any other] set in config/app.php
file.
Solution:
In case of WAMP, go to phpmyadmin page, then we can select cake_cms
database -> privilage-> create user id and password, same as in config
file config/app.php, refresh the http://localhost:8765/ page.
it should now show
CakePHP is able to connect to the database.
add a comment |
up vote
0
down vote
Error:
SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost'
(using password: YES).
Reason:
No user id: "my_app" with password: "secret" [or any other] set in config/app.php
file.
Solution:
In case of WAMP, go to phpmyadmin page, then we can select cake_cms
database -> privilage-> create user id and password, same as in config
file config/app.php, refresh the http://localhost:8765/ page.
it should now show
CakePHP is able to connect to the database.
add a comment |
up vote
0
down vote
up vote
0
down vote
Error:
SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost'
(using password: YES).
Reason:
No user id: "my_app" with password: "secret" [or any other] set in config/app.php
file.
Solution:
In case of WAMP, go to phpmyadmin page, then we can select cake_cms
database -> privilage-> create user id and password, same as in config
file config/app.php, refresh the http://localhost:8765/ page.
it should now show
CakePHP is able to connect to the database.
Error:
SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost'
(using password: YES).
Reason:
No user id: "my_app" with password: "secret" [or any other] set in config/app.php
file.
Solution:
In case of WAMP, go to phpmyadmin page, then we can select cake_cms
database -> privilage-> create user id and password, same as in config
file config/app.php, refresh the http://localhost:8765/ page.
it should now show
CakePHP is able to connect to the database.
edited Nov 10 at 4:10
answered Nov 10 at 2:51
Pankaj
7518
7518
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f30237702%2fcakephp-error-connection-to-database-not-access-denied-for-user-my-app%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
test_myapp is a test database setup by cakephp itself
– Keyur Padalia
May 14 '15 at 15:46