I want upload my Laravel Project in Cpanel.
The first page is the login page for users that when a user logins, he is redirected to another page.
When I want to send the user information to the database, I get this error:
“SQLSTATE[42000] [1044] Access denied for user ‘team’@’localhost’ to database ‘my database'”
In Cpanel
I’m creating a database and a user.
In phpMyAdmin
I’m creating my tables.
Alson in env
file I Add username and database name,
Where is my mistake? How can I solve it?
3
Answers
Change your .env file
Fist check your
.env
file. Make sure you put the right credentials for the database name, username and password. The database name and username in cPanel ususally starts with your cPanel username, such ascPanelUsername_databaseName
.If that does not solve the problem, you might want to check if you have the user added to the database. You will find it in the
MySQL Database
. If not, then navigate to theMySQL Database
section inside the cPanel and scroll down and you will findAdd User To Database
and then select the user that you want to give permission to access the database.This error occurs mostly in the live server go to the panel then go to MySQL Databases and add user privilege to the database you want then put these user credentials in yours.env file