When I try to login ?
Illuminate \ Database \ QueryException (1045) SQLSTATE[HY000] [1045]
Access denied for user 'homestead'#'localhost' (using password: YES)
(SQL: select * from users where email = andro.nady2015#gmail.com
limit 1)
Please try this:-
DB_HOST=127.0.0.1
in place of this:-
DB_HOST=localhost
thanks everyone , I solved this problem by download new version of Xampp
Related
This question already has answers here:
MySQL ERROR 1045 (28000): Access denied for user 'bill'#'localhost' (using password: YES)
(43 answers)
Closed 2 years ago.
When i try to go on my app, i have this message :
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost'
But when i make php artisan migrate, that work and tables are create on my local database ...
When i open mysql, i have :
Service : Mysql#localhost:3306
User : root
Password : ****
and my .env
APP_NAME=Laravel
APP_ENV=development
APP_KEY=**********************************
APP_DEBUG=true
APP_URL=localhost
TELESCOPE_ENABLED=true
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=mydatabase
DB_USERNAME=root
DB_PASSWORD=root
You need to set a permission:-
try: GRANT ALL PRIVILEGES ON * . * TO 'your_user'#'localhost';
The error on your site now is the permission denied.
I'm pretty new to coding with php and a friend of mine recommended the Limenius sf4 workshop. However, I'm stuck at the very beginning just to set the database up.
When typing php bin/console doctrine:schema:update --dump-sql into my shell (working on Windows) I get this error messages:
Error thrown while running command "doctrine:schema:update --dump-sql". Message: "An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user 'db_user'#'localhost' (using password: YES)"
In AbstractMySQLDriver.php line 113:
An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user 'db_user'#'localhost' (using password: YES)
In PDOConnection.php line 50:
SQLSTATE[HY000] [1045] Access denied for user 'db_user'#'localhost' (using password: YES)
In PDOConnection.php line 46:
SQLSTATE[HY000] [1045] Access denied for user 'db_user'#'localhost' (using password: YES)
I did look for answers online but they all seem to suggest I need to set up my .env file - which I did according to the tutorial in the first step. The webserver runs well, too. I just don't see where I go wrong exactly. Anyone else struggled with this part or may have an idea? Like I said, I'm pretty new to this.
As a test I've tried to create a new db using the command php bin/console doctrine:database:create - same error messages.
Okay, it did work out well once I've realised I need to type in my credentials twice.
This is my .env file (without the comments at top):
DATABASE_URL="mysql://root:root#127.0.0.1:3306/travolta"
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=9c47bf77dd9e746ab12e8fb021e226e1
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL="mysql://root:root#127.0.0.1:3306/travolta"
###< doctrine/doctrine-bundle ###
I did not notice the 2nd last line. I'm so sorry for that! Nevertheless, thanks a lot for helping me out and providing great tipps. It helped me to understand things better.
The database user name or password is incorrect. You can edit this data in the .env file.
Add this line into your .env file:
DATABASE_URL=mysql://{username}:{password}#127.0.0.1:3306/{database_name}
where:
{username} : the username you use to login into phpMyAdmin
{password} : the password you use to login into phpMyAdmin
{database_name} : the database name you would like to use with your Symfony application
Update
According to your comment, if you have not created your database yet, and you feel comfortable with phpMyAdmin, create one:
Then, give the user, sufficient privileges:
This question already has answers here:
Access denied for user 'homestead'#'localhost' (using password: YES)
(32 answers)
Closed 4 years ago.
When I try to run " php artisan key:generate " I get the following error in promptScreenshot of the error
Actually I am running a laravel project on different laptop. I am having this issue while generating a key. How can I solve it?
Error In Connection.php line 647: SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = homestead and table_name = permissions) In PDOConnection.php line 47: SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES) In PDOConnection.php line 43: SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES)
Just put Your system's database configuration in .env file. Like Database name user and password.
I'm randomly getting server errors because Laravel is trying to connect to the production database, despite the fact that I have a .env file set up and a majority of the time it connects to the correct database.
Here is the error I am receiving:
[2018-02-17 08:05:54] production.ERROR: SQLSTATE[HY000] [1045] Access denied for user 'forge'#'localhost' (using password: NO) (SQL: select * from information_schema.tables where table_schema = forge and table_name = settings) {"exception":"[object]
(Illuminate\\Database\\QueryException(code: 1045): SQLSTATE[HY000]
[1045] Access denied for user 'forge'#'localhost' (using password: NO)
(SQL: select * from information_schema.tables where table_schema = forge and table_name = settings) at C:\\wamp64\\www\\projects\\infusedx\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:664,
Doctrine\\DBAL\\Driver\\PDOException(code: 1045): SQLSTATE[HY000]
[1045] Access denied for user 'forge'#'localhost' (using password: NO)
at
C:\\wamp64\\www\\projects\\infusedx\\vendor\\doctrine\\dbal\\lib\\Doctrine\\DBAL\\Driver\\PDOConnection.php:47,
PDOException(code: 1045): SQLSTATE[HY000] [1045] Access denied for
user 'forge'#'localhost' (using password: NO) at
C:\\wamp64\\www\\projects\\infusedx\\vendor\\doctrine\\dbal\\lib\\Doctrine\\DBAL\\Driver\\PDOConnection.php:43)
Why would doctrine be trying to connect to the wrong database? Is it being insantiated before dotenv sometimes?
First
You can try clear or re-cache your configurations
php artisan config:clear or php artisan config:cache
before running your migration commands
Secondly
I had this issue on heroku. When trying to run migration commands from heroku's ssh heroku ps:exec environment. i was doing:
heroku ps:exec
and
php artisan migrate
but the env variables set in the heroku app isn't available to laravel (env('DB_DATABASE'), etc).
To fix this, i had to run the migrations from the bash
heroku run bash
then
php artisan migrate
I have a problem when I want to register in laravel. After completing the registration form I see this error message:
QueryException in Connection.php line 770:
SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost' (using password: YES) (SQL: select count(*) as aggregate from users where email =
thank you for helping me.
Create DB and add information in /.env file
DB_HOST=localhost
DB_DATABASE=YOUR_DB_NAME
DB_USERNAME=YOUR_DB_USER_NAME
DB_PASSWORD=YOUR_DB_USER_PASSWORD