MySQL Variables automatic_sp_privileges 数据库 参数变量解释及正确配置使用

本站中文解释

MySQL自动SP权限变量控制MySQL数据库服务器是否自动为每个用户分配存储过程执行特权。

通常,数据库系统需要特定的权限以访问特定的存储过程,以便运行该存储过程,而MySQL提供了一种自动设置权限的功能,也就是automatic_sp_privileges变量。其默认设置为ON,可以令系统自动为每个用户分配存储过程执行特权,以使用户能够访问和使用分配给它们的存储过程。在大多数情况下,这是可取的;但是,由于安全性方面的原因,某些系统可能需要仅允许特定用户访问特定的存储过程,这时可以将此变数设置为OFF来拒止自动授证。

设置automatic_sp_privileges变量的方法如下:

1)使用MySQL客户端登录数据库服务器。

2)使用SET语句进行设置:

SET GLOBAL automatic_sp_privileges=OFF|ON;

3)确认设置:

SELECT @@GLOBAL.automatic_sp_privileges;

官方英文解释

automatic_sp_privileges

Command-Line Format --automatic-sp-privileges[={OFF|ON}]
System Variable automatic_sp_privileges
Scope Global
Dynamic Yes
Type Boolean
Default Value ON

When this variable has a value of 1 (the default), the server
automatically grants the
EXECUTE and
ALTER ROUTINE privileges to the
creator of a stored routine, if the user cannot already
execute and alter or drop the routine. (The
ALTER ROUTINE privilege is
required to drop the routine.) The server also automatically
drops those privileges from the creator when the routine is
dropped. If
automatic_sp_privileges is 0,
the server does not automatically add or drop these
privileges.

The creator of a routine is the account used to execute the
CREATE statement for it. This might not be
the same as the account named as the
DEFINER in the routine definition.

If you start mysqld with
--skip-new,
automatic_sp_privileges is
set to OFF.

See also Section 23.2.2, “Stored Routines and MySQL Privileges”.


数据运维技术 » MySQL Variables automatic_sp_privileges 数据库 参数变量解释及正确配置使用