This article will deals with how to add a user and grant Root privileges on centos

Already we know about how to create the mysql database ,create an user for the data base and how to assign the user to the database.

Now we will know how to grand permission or privileges to that user.

Step 1: Add the User

It’s just one simple command to add a user. In this case, we’re adding a user called myuser :

adduser myuser

Now set the password for the new user:

passwd myuser

Step 2: Grant Root Privileges to the User

For this we have to open the editor like vim editor or use nano editor to edit or add the followig command lines.

Here we can use editing files with Vim Text Editor,

 visudo

Find the following code:

## Allow root to run any commands anywhere
root ALL=(ALL) ALL

In this case, we’re granting root privileges to the user myuser . Add the following below that code:

 myuser ALL=(ALL) ALL

Then exit and save the file with the command :wq .

If you’ve followed the instruction above correctly, then you should now have a user setup by the name of myuser which can use sudo to run commands as root!

Categories: NEW/ADVANCED