Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
mysql_grantparser - parse MySQL SHOW GRANTS
import mysql_grantparser
grants = mysql_grantparser.Exporter(
host='127.0.0.1',
port=3306,
user='root',
password='pa55w0rd',
).export()
mysql_grantparser is SHOW GRANTS parser for MySQL, inspired by Ruby's Gratan.
This module returns privileges for all users as following dict.
{
'USER@HOST': {
'user': USER,
'host': HOST,
'objects': {
'DB_NAME.TABLE_NAME': {
'privs': [ PRIV_TYPE, PRIV_TYPE, ... ],
'with': 'GRANT OPTION',
},
...
},
'options': {
'identified': '...',
'required': '...',
},
},
...
}
For example, this GRANT statement
GRANT SELECT, INSERT, UPDATE, DELETE ON orcl.* TO 'scott'@'%' IDENTIFIED BY 'tiger' WITH GRANT OPTION;
is represented as following.
{
'scott@%': {
'user': 'scott',
'host': '%',
'objects': {
'*.*': {
privs: [
'USAGE'
],
},
'orcl.*': {
'privs': [
'SELECT',
'INSERT',
'UPDATE',
'DELETE',
],
'with': 'GRANT OPTION',
}
},
'options': {
'identified': "PASSWORD XXX",
},
},
}
FAQs
parse MySQL SHOW GRANTS.
We found that mysql-grantparser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.