error in database connection when upload laravel on sharedhost - laravel-5

i have a project (laravel + voyager + passport) it is work perfect on localhost, but when deploy to sharedhost (Hostinger), i faced this error when try to access (voyager login page):
"SQLSTATE[28000] [1045] Access denied for user 'osama_mis-user'#'localhost' (using password: YES) (View: /home1/osama/public_html/vendor/tcg/voyager/resources/views/login.blade.php)
and i am sure is my information in (.env) is right
i also delete config.php file from bootstrap/cache but still faced this problem?

Related

Laravel app not connecting after deployment to live server

After deploying my Laravel app to inMotion hosting, I am having issues connecting to the database. What is strange is that if I use a PHP script to test the connection, it works. However, when trying to login I get this error:
SQLSTATE[HY000] [1045] Access denied for user #'localhost' (using password: YES) (SQL: select * from `users` where `email` = .com limit
I am using the exact same username and password in the .env file as I did in the PHP test script. I have tried clearing the cache and also changing the password for the database as well as my username.
Turns out it was the password in the .env file. It had special characters, so I had to add quotation marks around it.
Better if you can clear the config cache and see. You can use the following command to clear the config cache in Laravel:
php artisan config:cache

Laravel can't access database

I cvurrently have a laravel application running on heroku, the issue here is, I keep getting the error that I can't connect to the database: SQLSTATE[HY000] [1045] Access denied for user 'user'#'ec2-54-74-209-179.eu-west-1.compute.amazonaws.com' (using password: YES). Now the host is wrong here, the environment files are TOTALLY different (except for the username) then what the error gives....
How can I resolve this issue?
I've tried to use the DB_URL env, but that gives the same result...
Did you set the .env correctly on what's running on their server?
You can see all your projects in laravel at TOOLS->DEPLOYEMNT->CONFIGURATIONS
add all the info and connect to the remote project. I did the same and changed the .env directly there.
and of course you have to clean all the cache cause even if you change the .env it will not work until you'll clear it
php artisan cache:clear;
php artisan config:clear;
php artisan route:clear;
Obviously this need to be executed on the project on heroku or aws (as it appears from the Error)

.env file not updating in server?

After I uploaded my Laravel project in Cpanel I have to configure my env file according to my database.
I put database name, database user name and password also.
but after I save in the database and refresh my browser. it says
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: NO) (SQL: select * from sliders)
even though I have changed env file in server. but still showing me root#localhost.
Can't figure it out how to solve this.
run php artisan config:clear
mostly because of .env being cached

"SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' : Laravel 5.3

Hi I'm having a problem with laravel 5.3
project was moved from one host to another
and I've updated the .env file
The project was working well in the old host
but when I moved to the new host, the site displaying this error
1/2
PDOException in Connector.php line 119: SQLSTATE[HY000] [1045] Access denied for user 'xxxx'#'localhost' (using password: YES)
2/2
QueryException in Connection.php line 770: SQLSTATE[HY000] [1045] Access denied for user 'xxxx'#'localhost' (using password: YES) (SQL: select * from countries)
xxxx => The user name for the old database was not updated. i do not know the reasonenter image description here
There are many possible reasons to throw this exception, let's explore them:
There is a kind of cache in the .env file. In this case, you could only rewrite the DB variables, run php artisan config:clear and restart the server.
Maybe some of the DB variables aren't right. In this case, you could check out the values.
The user is right but he hasn't permission to access the database. In this case, you could check out the user permissions.
I hope that one of these tips help you.
Check the .env file it should include all value like CONNECTION, HOST, PORT, etc.
php artisan config:clear
composer dump-autoload and restart the server
the SQLSQLSTATE[HY000] [1045] seems like the password in your .env file doesn't match with the database's password.
You can check the database pass and user in the new server and put into your .env file.
Good luck

SQLSTATE[28000] [1045] Access denied for user 'root'#'localhost' (using password: NO)

I have uploaded my project on my hosting ..But when i tried to access form url I got the following Error
QueryException in Connection.php line 647:
SQLSTATE[28000] [1045] Access denied for user 'root'#'localhost' (using password: NO)
I have changed the following credentials of .env
DB_DATABASE=cpanel_database
DB_USERNAME=cpanel_db_name
DB_PASSWORD=cpanel_db_password
What could be the error for getting the Above Error?
Just make sure your database credentials are correct.
Might be chance that configurations run from cache. once clear is by login in server via ssh or remove config.php file from bootstrap/cache/ folder.
Good luck.
Looks like it is not reading the credentials from your .env file. because it is reading root as the user instead of the username specified in the .env.
Check to make sure it is reading the .env and not the default parameters in the config/database.php file

Resources