Press enter to see results or esc to cancel.


Create new MySQL user for your Database and Grant all privileges

This tutorial shows how to create a new user for MySql and Grant all privileges to the user.

  1. 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.

  2. 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

  3. Now to grant all privileges to the user

    grant all on mysql.* to 'newuser'@localhost identified by 'mypass'

  4. Now to login with the new user. The command is

    mysql -u newuser -pmypass
    


Tags