Hello,
In this tutorial I will show you how you can create a user account in mysql and assign permission to that account according to your need.
1. Open up your command prompt
2. Inside CMD navigate to bin folder inside your mysql and type mysql
Now mySql stores all the user information in a database called mysql, so we will use this database to create a account
3. Type use mysql ;
Now Inside this database there is a table name user, we will use this table. If you want to take a look of this table type select * from user \G ;
By using the above query you can see it list all the privileges you can set along with Host,User and Password
4. Now in order to create a user type the following query
insert into user (Host,User,Password,create_privs,delete_priv,update_priv,insert_priv) values ('localhost','Ali',Password("f00"),'Y','Y','Y','Y');
Now to describe the above query
As you can see I used 4 types of privileges and set them to yes, all the remaining privileges will set to No by default. You can specify fields according to your requirement.
Now for the password, I used a built in function name Password(), This function is use to decrypt our password, as you can see the below figure although our password is f00 but it is listed as a complex number
In this tutorial I will show you how you can create a user account in mysql and assign permission to that account according to your need.
1. Open up your command prompt
2. Inside CMD navigate to bin folder inside your mysql and type mysql
Now mySql stores all the user information in a database called mysql, so we will use this database to create a account
3. Type use mysql ;
Now Inside this database there is a table name user, we will use this table. If you want to take a look of this table type select * from user \G ;
By using the above query you can see it list all the privileges you can set along with Host,User and Password
4. Now in order to create a user type the following query
insert into user (Host,User,Password,create_privs,delete_priv,update_priv,insert_priv) values ('localhost','Ali',Password("f00"),'Y','Y','Y','Y');
Now to describe the above query
As you can see I used 4 types of privileges and set them to yes, all the remaining privileges will set to No by default. You can specify fields according to your requirement.
Now for the password, I used a built in function name Password(), This function is use to decrypt our password, as you can see the below figure although our password is f00 but it is listed as a complex number
No comments:
Post a Comment