Here are the SQL commands you need to run to quickly setup a new MySQL/MariaDB database and user:
CREATE DATABASE newdatabase;
CREATE USER ‘newuser’@’localhost’ IDENTIFIED BY ‘MySecretPassword’;
GRANT ALL PRIVILEGES ON newdatabase.* TO ‘newuser’@’localhost’;
This assumes the new user will only connect from localhost (for example a web site running on the same server). You should always create a separate database for each web site you are running, and make sure each one has its own user. This way, if one web site is breached, the hackers won’t get access to the other web sites’ data.
For added security, you could grant only select, insert and delete privileges to the new user:
GRANT SELECT, INSERT, UPDATE ON newdatabase.* TO ‘newuser’@’localhost’;
This won’t work with for example Drupal, since it needs to be able to create and modify tables as you create new content types.