·
1 min read
Mariadb handy commands
Mariadb sql collection for user management
User management
Create
When creating user make use you replace localhost to the ip
the client can access from or add % if you allow global access
1
|
CREATE USER 'username'@'localhost' IDENTIFIED BY 'strong_password';
|
Update
1
|
ALTER USER username WITH PASSWORD 'new_password';
|
Delete
1
|
DROP USER IF EXISTS username;
|
Privileges
Admin privileges
1
2
|
GRANT ALL PRIVILEGES ON my_database.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
|
Limited access
1
2
3
|
GRANT SELECT ON my_database.table1 TO 'username'@'localhost';
GRANT SELECT ON my_database.table2 TO 'username'@'localhost';
FLUSH PRIVILEGES;
|
Database
Create
1
|
CREATE DATABASE database_name;
|