BLACK FRIDAY SALE IS LIVE !!!!!

Need Assistance?

In only two hours, with an average response time of 15 minutes, our expert will have your problem sorted out.

Server Trouble?

For a single, all-inclusive fee, we guarantee the continuous reliability, safety, and blazing speed of your servers.

How to Create User in MySQL and Grant Permission

MySQL is an open-source database management system for storing, organising, and retrieving data. It includes a number of options for granting individual users access within tables and databases.

On our server management plan, our experts will cover MySQL setup, optimisation and database migrations.

Create User in MySQL

Login to MySQL server with below command

mysql -u root -p
Enter Password:

Now, create the user

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

At this time, newuser does not have any access to the databases. In fact, newuser will be unable to access the MySQL shell even if they try to login (using the password, given). As a result, the first step is to give the user access to the information they’ll need.

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

The asterisks in this command denote the database and table that they can access, respectively. The user can read, edit, execute, and conduct all tasks across all databases and tables using this command.

Always remember to reload all privileges after you’ve confirmed the permissions you wish to set up for your new users.

FLUSH PRIVILEGES;

Run the following commands to check a user’s current permissions

SHOW GRANTS FOR 'username'@'localhost';

If you need any assistance in setting up MySQL user and Database on your server, our technical experts are available anytime to help you.

Liked!! Share the post.

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Can't get what you are looking for?

Available 24x7 for emergency support.