Ask Ubuntu Asked by yyusufaslan on December 31, 2021
I have started my first website (in development) with a simple authentication structure. When I run my website with Homestead, database connection does not work. Actually I can run any mysql command from terminal or mysql workbench, but when I try from browser (homestead.app), I get this error:
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
Here my .env
information:
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
I changed the permission and restarted server but same result!
This is because you did not grant access to that specific user on localhost. To remedy this, use this:
root
here is the MySQL root, NOT the ubuntu root - you could also use other users having sufficient access level):$ mysql --user=root --password=root_password homestead
homestead
):CREATE USER 'homestead'@'localhost' IDENTIFIED BY 'secret'; GRANT SELECT PRIVILEGES ON homestead.* to 'homestead'@'localhost' IDENTIFIED BY 'secret';
Refer to the MySQL manual for more info on other options.
This being said, you might preferably post such questions on other sites dedicated to DB administration.
Answered by Marc Vanhoomissen on December 31, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP