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

mysqlgrantsdump

Description

mysqlgrantsdump 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 path/to/src
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

mysqlgrantsdump 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.7.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mysqlgrantsdump-0.0.7-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file mysqlgrantsdump-0.0.7.tar.gz.

File metadata

  • Download URL: mysqlgrantsdump-0.0.7.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for mysqlgrantsdump-0.0.7.tar.gz
Algorithm Hash digest
SHA256 560dc77bcae36c554dc649c82e18a08bdd5e387f55fc7cc701d3ab43aec6c9f7
MD5 e5a829dbe31347e4664fddd85dc68fa1
BLAKE2b-256 43c061b9406ddeea7459593bc8ceafc98c5ada4451e55ca368ade99a903b3935

See more details on using hashes here.

File details

Details for the file mysqlgrantsdump-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for mysqlgrantsdump-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 23e8418c7aa343f47cc8a9e1df4319a8e188af11c41207e409ea52c92da8861d
MD5 f8a34c534803317b63c40d4915ccfd65
BLAKE2b-256 a57e5e4bc1fcaed490dc234dc6dde4e215628b1a76e89865bea94a7319bee53a

See more details on using hashes here.

Supported by

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