mysql_grantee
NAME
mysql_grantee(): Return a qualified MySQL grantee (account) based on user and host.TYPE
FunctionDESCRIPTION
MySQL is inconsistent in its reference to user accounts. At times, a user+host combination is used (e.g. the mysql.user table, or the even fuzzier PROCESSLIST). Other times, a grantee is used (e.g. with INFORMATION_SCHEMA tables).
This function is a simple text wrapper function, which is useful in automation of SQL query generation, or otherwise in comparing and recognizing accounts in different formats (user+host vs. grantee formats).
SYNOPSIS
mysql_grantee(mysql_user char(16) CHARSET utf8, mysql_host char(60) CHARSET utf8) RETURNS VARCHAR(100) CHARSET utf8
Input:
- mysql_user: name of user.
- mysql_host: name of host.
Output: fully qualified GRANTEE name
EXAMPLES
Qualify a GRANTEE:
SELECT common_schema.mysql_grantee('web_user', '192.128.0.%') AS grantee; +--------------------------+ | grantee | +--------------------------+ | 'web_user'@'192.128.0.%' | +--------------------------+