murilo
5 months ago
742
4
Servers

Error connecting database

Posted 5 months ago by murilo

I created a ubuntu server for laravel . I have a root user , that I added in .env file -

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=mywebsite
DB_USERNAME=root
DB_PASSWORD=mypassword


then I migrated the database with the command -

php artisan migrate

It migrated ok . BUT , it is givving this error -

Illuminate\Database\QueryException
SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: select `id`, `title`from `posts` order by `id` asc)

It is saying that I dont have permission with my user root , to select . BUT I had permission to migrate . how could I give permission to it ?

Thanks

Please sign in or create an account to participate in this conversation.