Estou me conectando ao MySQL com o usuário 'feedbackdev', mas as consultas são executadas com 'feedback', que é outro usuário no mesmo servidor.
root@board:~# mysql -u feedbackdev -p feedbackdev
Enter password:
mysql> select user();
+-----------------------+
| user() |
+-----------------------+
| feedbackdev@localhost |
+-----------------------+
mysql> select rating, COUNT(*) AS rating_count from order_feedback_view where feedback_created_at >= '2024-10-26 09:01:29' group by rating;
ERROR 1143 (42000): SELECT command denied to user 'feedback'@'localhost' for column 'source_id' in table 'orders'
Aqui estão as SUBVENÇÕES para os usuários
mysql> show grants for 'feedbackdev'@'localhost';
+----------------------------------------------------------------------+
| Grants for feedbackdev@localhost |
+----------------------------------------------------------------------+
| GRANT PROCESS, SUPER ON *.* TO `feedbackdev`@`localhost` |
| GRANT SET_USER_ID ON *.* TO `feedbackdev`@`localhost` |
| GRANT ALL PRIVILEGES ON `feedbackdev`.* TO `feedbackdev`@`localhost` |
+----------------------------------------------------------------------+
3 rows in set (0.00 sec)
mysql> show grants for 'feedback'@'localhost';
+---------------------------------------------------------------------------+
| Grants for feedback@localhost |
+---------------------------------------------------------------------------+
| GRANT PROCESS, SUPER, REPLICATION CLIENT ON *.* TO `feedback`@`localhost` |
| GRANT FLUSH_TABLES ON *.* TO `feedback`@`localhost` |
| GRANT ALL PRIVILEGES ON `feedback`.* TO `feedback`@`localhost` |
+---------------------------------------------------------------------------+
3 rows in set (0.00 sec)
MySQL versão 8.0.40