-- Create a user (or more) CREATE OR REPLACE USER nathan@'%' IDENTIFIED BY 'password'; -- CREATE USER 'aLeaf'@'%' IDENTIFIED BY "aLeaf"; -- Role admin, only they have permission to add others to their role CREATE OR REPLACE ROLE admin WITH ADMIN nathan@'%'; GRANT ALL ON *.* TO admin WITH GRANT OPTION; -- GRANT ALL PRIVILEGES ON *.* TO 'aLeaf'@'%'; -- 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 USAGE ON *.* TO 'nathan'@'%'; -- Allows usage of the tables I guess (default on create?) FLUSH PRIVILEGES; -- Remove root, to prevent root login DROP USER root, root@localhost -- Create tables, and insert data into them -- USE ecomdb; -- This is setup by default mariadb compose -- CREATE TABLE products (id mediumint(8) unsigned NOT NULL auto_increment,Name varchar(255) default NULL,Price varchar(255) default NULL, ImageUrl varchar(255) default NULL,PRIMARY KEY (id)) AUTO_INCREMENT=1; -- INSERT INTO products (Name,Price,ImageUrl) VALUES ("Laptop","100","c-1.png"),("Drone","200","c-2.png"),("VR","300","c-3.png"),("Tablet","50","c-5.png"),("Watch","90","c-6.png"),("Phone Covers","20","c-7.png"),("Phone","80","c-8.png"),("Laptop","150","c-4.png");