select和insert语句是允许进行优化和修复的最低MySQL用户权限。
您可以使用以下语法为用户提供插入和选择特权-
grant insert,select on yourDatabaseName.* to 'yourUserName'@'localhost';
首先,这是创建用户的查询-
mysql> create user 'Emma'@'localhost' identified by 'Emma123';
这是为上述用户提供赠款的查询-
mysql> grant insert,select on web.* to 'Emma'@'localhost';
这是显示上述用户的所有授予的查询-
mysql> show grants for 'Emma'@'localhost';
这将产生以下输出-
+-------------------------------------------------------+ | Grants for Emma@localhost | +-------------------------------------------------------+ | GRANT USAGE ON *.* TO `Emma`@`localhost` | | GRANT SELECT, INSERT ON `web`.* TO `Emma`@`localhost` | +-------------------------------------------------------+ 2 rows in set (0.00 sec)