Access denied for user ‘dbuser’ [duplicate] - php

This question already has answers here:
Access denied for user 'homestead'#'localhost' (using password: YES)
(32 answers)
MySQL: Access denied for user 'test'#'localhost' (using password: YES) except root user
(18 answers)
Closed 5 years ago.
In order to create a database, I run the command in terminal:
php artisan migrate
I get this:
SQLSTATE [HY00] [1045] Access denied for user ‘dbuser’#‘localhost’ (using password: YES) (SQL: select * from information_schema.table where table_schema = blog and table_name = migrations)
I’ve ran the command php artisan config:cache and it was successful but I still can’t seem to configure phpMyAdmin to connect to database? How can I solve this error?

After making any configuration related changes in .env or to files in config directory,
You need to run:
$ php artisan config:clear

Related

php artisan key:generate does not generate key [duplicate]

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.

Laravel/Doctrine randomly tries to connect to production database

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

Access denied for user#localhost [duplicate]

This question already has answers here:
MySQL ERROR 1045 (28000): Access denied for user 'bill'#'localhost' (using password: YES)
(43 answers)
Closed 5 years ago.
I have installed xampp on Windows and am using phpmyadmin to create a database. When I paste the link of my php file corresponding to the database onto the browser I get the following error:
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'id2207666_aditijha20'#'localhost' (using password: YES) in C:\xampp\htdocs\Register2.php on line 3
I tried the 'Grant Permission' command in SQL but that didn't work either.
GRANT ALL PRIVILEGES ON id2207666_perfect_fit.* TO 'id2207666_aditijha20'#'localhost' WITH GRANT OPTION;
ERROR: #1044 - Access denied for user 'id2207666_aditijha20'#'%' to database 'id2207666_perfect_fit'
How do I fix this?
Thanks in advance
there's a difference between 'id2207666_aditijha20'#'%' and 'id2207666_aditijha20'#'localhost'
Issue your grant for the user that you're using to connect:
GRANT ALL PRIVILEGES ON id2207666_perfect_fit.* TO 'id2207666_aditijha20'#'%' WITH GRANT OPTION;
Also, you may need to flush privileges

SQLITE asking for password in laravel migration

I made SQLite as my default database in Laravel, why is it that PHP artisan migrate is still asking for credentials?
SQLSTATE[HY000] [1045] Access denied for user 'homestead'#'localhost'
(using password: YES)

Can't connect to mysql Laravel-forge

I've just purchased a subscription atnforge for 10 dollars/month.
But when I want to connect to mydatabase (mysql),
it's telling me:
Connected to host, but unable to connect to database forge.
Be sure that the database exists and that you have the necessary
privileges.
MySQL said: Unknown database 'forge'
I have an email from forge with my login information. I can ssh into my server. I've also set my ssh key on my mac.
What am I doing wrong? Here a pic with my info:
EDIT:
Also when I deploy from github I receive this error message:
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'forge'#'localhost' (using password: NO)
But yesterday it worked! Now it doesn't?
EDIT:
ERROR LOG:
From github.com:
* branch master -> FETCH_HEAD
Already up-to-date.
Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Generating autoload files
> php artisan clear-compiled
> php artisan optimize
Generating optimized class loader
Compiling common classes
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'forge'#'localhost' (using password: NO)

Categories