Hi,
I'm starting to learn Laravel, but I'm encountering a big error for the database connection that I really don't understand... (SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES))
I just want to display this route :
Route::get('test', function(){ $articles = App\Article::find(1); print_r($articles); }); But it returns me that I have no access to my database...
Here is my .env file :
DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=fabien DB_USERNAME=root DB_PASSWORD=-
I'm under linux ubuntu and I created my database fabien manually in my phpmyadmin being connected as root with the password as null, so that should be the same user...
Could someone help me please ? I'm desperate...
Hi,
If I read your question correctly you set
DB_PASSWORD=-
rather than
DB_PASSWORD=
Could this be the issue?
I would also say it's likely that you actually need a password. This is more of a guess though.
I heard about the fact that it's better to put '-' instead of null, but the result is the same...
So I would need to set a password to my databse ?
I'd say so, yes. If you get the same error without the '-' there is probably a default value somewhere.
Do you know how to set a password to phpmyadmin on ubuntu ? I tried following tutorials but it didn't work :/
I'm not sure with phpmyadmin, but you could have a look at this one and do it at command line. http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
You could also just create another user: https://wiki.phpmyadmin.net/pma/user_management
Nothing of this works --' I created a new user with all previledge and a password, I edited the .env file to put the new username and password, but it still display this error... SQLSTATE[28000] [1045] Access denied for user 'fab'@'localhost' (using password: YES)
After a day of research, I achived to debbug this access problem, but now it tells me that the table in my database doesn't exist whereas it does exist for sure...
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'fabien.articles' doesn't exist (SQL: select * from articles
)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community