MySql - How to Create a New User

MySql - How to Create a New User

Make a new user within the MySQL shell:

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

replace newuser and password with the new username and password but leave 'localhost' not the servers IP as this is the host for the mysql account.

Next step is to set some permissions

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

replace the * with a spercific table if you would like the user to only have access to a subset of the tables, if not leave as an * to grant them access to all tables in this database.