I want to connect the MySQL database to the Laravel project without XAMPP (Using Ubuntu 22.04).
I created a database called my_project and added it to.env file
Up next to create migrations I used artisan command: php artisan migrate
.
As an output it returned
SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: select * from information_schema.tables where table_schema = my_database and table_name = migrations and table_type = 'BASE TABLE')
Any ideas what I might be doing wrong?
Apparently, my dad found the answer to my problem :D problem was in giving my database user grant only for localhost. However, it needs to be granted so it can be connected from any IP.
CREATE USER 'amir'@'%' IDENTIFIED BY 'password';