Login
登录 注册 安全退出
当前位置: 首页 > 文档资讯 > 技术教程 > 允许优化和修复的最低 MySQL 用户权限是多少?

允许优化和修复的最低 MySQL 用户权限是多少?

时间:2023-09-15浏览: [ ]

select 和 insert 语句是允许优化和修复所需的最低 MySQL 用户权限。

您可以使用以下语法向用户授予插入和选择权限 -

grant insert,select on yourDatabaseName.* to 'yourUserName'@'localhost';

首先,这是创建用户的查询 -

mysql> create user 'Emma'@'localhost' identified by 'Emma123';
Query OK, 0 rows affected (0.26 sec)

这是为上述用户提供资助的查询 -

mysql> grant insert,select on web.* to 'Emma'@'localhost';
Query OK, 0 rows affected (0.21 sec)

这里是显示上述用户的所有授权的查询 -

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)
复制本文链接文章为作者独立观点不代表优设网立场,未经允许不得转载。