How To Create a New User and Grant Permissions in MySQL
MySQL is an open source database management software that helps users store, organize, and later retrieve data.
It has a variety of options to grant specific users nuanced permissions within the tables and databases—this tutorial will give a short overview of a few of the many options.
Open your shell, login with root account MySQL, then type:
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
Sadly, at this point newuser has no permissions to do anything with the databases.
In fact, if newuser even tries to login with the password password, they will not be able to reach the MySQL shell.
Notes
For create database you can use:
CREATE DATABASE [databasename];
Then grant user to database with this command:
GRANT ALL PRIVILEGES ON [databasename].* TO 'newuser'@'localhost';
Published by Nirantara
Nirantara is an Indonesian Enterprise AI company specializing in Enterprise AI, RAG, Intelligent Search, and AI Automation. Article written by andre.
Related Articles
No related articles found.