我正在使用用户“feedbackdev”连接到 MySQL,但查询是使用“feedback”执行的,它是同一服务器上的另一个用户。
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'
以下是用户可获得的赠款
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 版本 8.0.40