make sure to flush privileges after editing grant tables
mairadb -- mariadb cli
mariadb -u user -p -- mariadb cli as specific user
CREATE USER user@host IDENTIFIED BY 'password'; -- create a user with a password
USE database_name; -- select database
ALTER USER 'user'@'localhost' IDENTIFIED BY 'new_password'; -- change user password (flush privileges after changing password)
exit -- exit the cli
SHOW DATABASES; -- show all databases
SHOW TABLES; -- show the tables in the database
SHOW COLUMNS FROM table_name; -- show columns from the table
ALTER TABLE table_name ADD COLUMN column_name datatype; -- add a column to an existing table
ALTER TABLE table_name DROP COLUMN column_name; -- drop a column from a table
ALTER TABLE table_name MODIFY COLUMN column_name datatype; -- change the datatype of a column
ALTER TABLE table_name RENAME COLUMN column_name TO new_column_name; -- rename a column
SELECT column_name FROM table_name; -- get values from column in a table
DELETE FROM table_name WHERE column_name = 'value_to_delete'; -- with a database already selected, delete matching column value/s from a table
DELETE FROM table_name WHERE column_name is null; -- delete null values
SELECT User FROM mysql.user; -- list the user table from the mysql database
DROP USER 'username'@'host'; -- this is whilst the mysql database is the one in use (show the table entries to get the host to use SELECT User, Host FROM user; or SELECT User, Host FROM mysql.user;)
CREATE USER 'user', 'user'; -- create users
RENAME USER 'user'@'host' TO 'new_name'@'host'; -- rename user
GRANT ALL PRIVILEGES ON *.* TO 'user'@'host'; -- grant all privileges to a user
GRANT ALL PRIVILEGES ON database_name.* TO 'user'@'host'; -- grant all privileges on all of a databases tables to a user
GRANT ALL PRIVILEGES ON database_name.* TO 'user'@'host' IDENTIFIED BY 'password'; -- grant all privileges on all of a databases tables to a user using a password
FLUSH PRIVILEGES; -- clears and reloads internal caches used by mariadb
SHOW GRANTS FOR 'user'@'host'; -- show all grants for a user
NOW() -- get current datetime from the database