Categories

Category cover

Automation
43 posts

Category cover

Security
20 posts

Category cover

Notes
19 posts

Category cover

Personal Security
15 posts

Category cover

CISO
14 posts

Category cover

Infrastructure
12 posts

Category cover

Learning paths
9 posts

Category cover

OT/ICS
6 posts

Category cover

UNetLab
4 posts

Category cover

Books
3 posts

Category cover

Write-up
3 posts

Category cover

OSInt
2 posts

Category cover

My life
1 posts

MySQL/MariaDB User Management

Andrea Dainese
July 09, 2019
Post cover

I’m now a DB admin and I always forget how to manage MySQL/MariaDB users. Here are some self-notes to not search over and over the same topic on Google.

Delete user:

DROP USER IF EXISTS user;

Create user:

CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass';

Grant privileges:

GRANT ALL PRIVILEGES ON database_name.* TO 'user'@'localhost';

or

GRANT ALL PRIVILEGES ON database_name.* TO 'user'@'%';

Show User-Specific Grants:

SELECT Host,User from mysql.user;

Show Database-Specific Grants:

SELECT * FROM mysql.db;

Show Table-Specific Grants:

SELECT * FROM mysql.tables_priv;

Show Column-Specific Grants:

SELECT * FROM mysql.columns_priv;