'MYSQL not connecting to LARAVEL but credentials are correct and cant use artisan command
On the webpage this is produced:
sqlstate[hy000] [1698] access denied for user 'root'@'localhost' (sql: select * from information_schema.tables where table_schema = laravel and table_name = categories and table_type = 'base table')
Attempts:
php artisan config:cache,php artisan config:clear,php artisan cache:clear=> Not working since artisan displays the mysql error; so artisan is useless, it must be a database issue- env file credentials are correct
sudo systemctl restart mysql.service=> problem persists- restart the DO Server with
sudo poweroff=> problem persists
Solution 1:[1]
The Solution:
sudo mysql -u root -p=> login to mysql as root with passworduse mysql;=> use the mysql databaseUPDATE user SET plugin='mysql_native_password' WHERE USER='root';=> change the authentication type of root to mysql_native_passwordFLUSH PRIVILEGES;=> reload the grant tableservice mysql restart=> restart mysql
After this is completed, the error should be cleared.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | darylvickerman |
