This tutorial shows how to create a new user for MySql and Grant all privileges to the user.
- First lets check how many users is present for MySql now. It will be present in user table in MySql database
The command for seeing the user available is
select user,host,password from user
As per the result we have only user root and the host is localhost. Now lets create a new user.
Now to create a new user under host mysql the Command is shown below.
create user 'newuser'@'localhost' identified by 'mypass'
Now the user is created. Lets check that.
select host,user,password from user
Now to grant all privileges to the user
grant all on mysql.* to 'newuser'@localhost identified by 'mypass'
Now to login with the new user. The command is
mysql -u newuser -pmypass