I'm trying to put a project to production. I'm getting an access error when running an Axios post request to the Laravel API. (I'm not getting this error on the local machine)
[2019-01-28 12:18:04] local.ERROR: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: select * from `oauth_clients` where `id` = 2 limit 1) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 1698): SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: select * from `oauth_clients` where `id` = 2 limit 1) at /var/www/html/RemApp/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, PDOException(code: 1698): SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' at /var/www/html/RemApp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68)
I'm not getting an error when running migrations. Below is my .env file. (I have not changed the config/database.php)
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=AppName
DB_USERNAME=root
DB_PASSWORD=mypasswordhere
Tried clearing cache with:
php artisan cache:clear php artisan config:clear
Removed quotes from DB_PASSWORD
- The credentials are correct. (Can login and run queries using mysql -u -p)