|
|
|
@ -1,20 +1,25 @@
|
|
|
|
-- Create a user (or more)
|
|
|
|
-- Create a user (or more)
|
|
|
|
CREATE OR REPLACE USER nathan@'%' IDENTIFIED BY 'password';
|
|
|
|
CREATE OR REPLACE USER nathan@'%' IDENTIFIED BY 'password';
|
|
|
|
-- CREATE USER 'aLeaf'@'%' IDENTIFIED BY "aLeaf";
|
|
|
|
CREATE USER 'aLeaf'@'%' IDENTIFIED BY "aLeaf";
|
|
|
|
|
|
|
|
|
|
|
|
-- Role admin, only they have permission to add others to their role
|
|
|
|
-- Role admin, only they have permission to add others to their role
|
|
|
|
CREATE OR REPLACE ROLE admin WITH ADMIN nathan@'%';
|
|
|
|
CREATE OR REPLACE ROLE admin WITH ADMIN nathan@'%';
|
|
|
|
GRANT ALL ON *.* TO admin WITH GRANT OPTION;
|
|
|
|
GRANT ALL ON *.* TO admin WITH GRANT OPTION;
|
|
|
|
|
|
|
|
-- GRANT ALL PRIVILEGES ON *.* TO admin WITH GRANT OPTION;
|
|
|
|
|
|
|
|
|
|
|
|
-- GRANT ALL PRIVILEGES ON *.* TO 'aLeaf'@'%';
|
|
|
|
CREATE DATABASE 'aNetwork';
|
|
|
|
|
|
|
|
GRANT ALL PRIVILEGES ON 'aNetwork'.* TO 'aLeaf'@'%'; -- The user the website is using for access
|
|
|
|
|
|
|
|
|
|
|
|
-- GRANT ALL PRIVILEGES ON *.* TO 'nathan'@'%' WITH GRANT OPTION; -- Priv, all of the belo
|
|
|
|
-- GRANT ALL PRIVILEGES ON *.* TO 'nathan'@'%' WITH GRANT OPTION; -- Priv, all of the belo
|
|
|
|
-- GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON *.* TO 'username'@'localhost';
|
|
|
|
-- GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON *.* TO 'username'@'localhost';
|
|
|
|
-- GRANT USAGE ON *.* TO 'nathan'@'%'; -- Allows usage of the tables I guess (default on create?)
|
|
|
|
-- GRANT USAGE ON *.* TO 'nathan'@'%'; -- Allows usage of the tables I guess (default on create?)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- https://stackoverflow.com/questions/64653778/why-are-not-working-my-roles-in-my-mysql-database
|
|
|
|
|
|
|
|
SET DEFAULT ROLE admin FOR nathan; -- https://mariadb.com/kb/en/set-default-role/
|
|
|
|
|
|
|
|
-- SET ROLE ALL;
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
FLUSH PRIVILEGES;
|
|
|
|
|
|
|
|
|
|
|
|
-- Remove root, to prevent root login
|
|
|
|
-- Remove root, to prevent root login (security, yo)
|
|
|
|
DROP USER root, root@localhost
|
|
|
|
DROP USER root, root@localhost
|
|
|
|
|
|
|
|
|
|
|
|
-- Create tables, and insert data into them
|
|
|
|
-- Create tables, and insert data into them
|
|
|
|
|