I got the same error below:
> ERROR 1044 (42000): Access denied for user 'john'@'localhost' to database 'apple'
So, I gave all privileges on all the tables in `apple` database to the user `john` with [GRANT][1] as shown below, then I could solve the error. *I logged in with the user `root`:
```sql
GRANT ALL ON apple.* TO 'john'@'localhost';
```
Or:
```sql
GRANT ALL PRIVILEGES ON apple.* TO 'john'@'localhost';
```
[1]: https://dev.mysql.com/doc/refman/8.0/en/grant.html
I got the same error below:
> ERROR 1044 (42000): Access denied for user 'john'@'localhost' to database 'mysql'
So, I gave all privileges on all the tables in `mysql` database to the user `john` with [GRANT][1] as shown below, then I could solve the error. *I logged in with the user `root`:
```sql
GRANT ALL ON mysql.* TO 'john'@'localhost';
```
Or:
```sql
GRANT ALL PRIVILEGES ON mysql.* TO 'john'@'localhost';
```
[1]: https://dev.mysql.com/doc/refman/8.0/en/grant.html