Skip to main content

A Python package to fetch a list of all users and grants from a MariaDB database and output them in a human-readable table format to the console.

Project description

mysql-grantsdump

Description

mysql-grantsdump is a command-line tool that allows you to dump a list of all MySQL users and their grants. It connects to a MySQL database and retrieves the users and their associated permissions, and outputs them in a table format using the prettytable module.

Getting Started

  1. Install the required dependencies by running pip install -r requirements.txt
  2. Run the tool using the following command: python mysql_grants_dump.py [OPTIONS]
  3. The available options are as follows:
    • -H, --host: The MySQL database host name or IP address. Default is localhost.
    • -u, --user: The MySQL database user name. Default is root.
    • -d, --database: The MySQL database name.
    • -P, --port: The MySQL database port number. Default is 3306.

Example Usage

From pip

mysqlgrantsdump -u root -p # Connects default to localhost for host.

From source

pip install -r requirements.txt
cd src/io/lyuda/
mysqlgrantsdump.py -u root -p

Example Output

+------------------+-----------+--------+--------+--------+--------+--------+------+-------+-------+
|       User       |    Host   | Select | Insert | Update | Delete | Create | Drop | Grant | Super |
+------------------+-----------+--------+--------+--------+--------+--------+------+-------+-------+
|   andrewhoward   |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|    carsonlisa    |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|      dsmith      |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|  elizabethbrown  |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|     grant03      |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|      ilopez      |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|   jeanneconrad   |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|     johngray     |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|  joshuawhitaker  |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|    kimolivia     |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|    krystal52     |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|     larry00      |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|   monicaadams    |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
| rodrigueznicole  |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|    uhernandez    |     %     |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
| mysql.infoschema | localhost |   Y    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|  mysql.session   | localhost |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   Y   |
|    mysql.sys     | localhost |   N    |   N    |   N    |   N    |   N    |  N   |   N   |   N   |
|       root       | localhost |   Y    |   Y    |   Y    |   Y    |   Y    |  Y   |   Y   |   Y   |
+------------------+-----------+--------+--------+--------+--------+--------+------+-------+-------+

License

mysql-grantsdump is released under the MIT License. See LICENSE for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mysqlgrantsdump-0.0.4.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

mysqlgrantsdump-0.0.4-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page