Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

MySQL Database Creation And Grant Permission To Particular User

Step 1: Login to MySQL ( you will need an account )
[root@vps.net ~]# mysql -u root1 -p
  Enter password:
Step 2: Create the Database
mysql> create database db1;
Query OK, 1 row affected (0.00 sec)
Step 3: Verify that it’s there
mysql> show databases;
| Database           |
| information_schema |
| mysql              |
| db1                |
| test               |
4 rows in set (0.00 sec)
Step 4: Create the User & List the User
mysql> create user db1_user;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT User FROM mysql.user;
| User    |
| db1_user|
| jak3    |
|         |
| kkkk    |
|         |
| kkk7    |
6 rows in set (0.00 sec)
Step 5: Grant privileges while assigning the password
mysql> grant all on db1.* to 'db1_user'@'localhost' identified by 'db1_user_password';
Query OK, 0 rows affected (0.00 sec)
Note: The localhost field usually doesn’t have to be edited, but you can set it to the specific address.
The above example grants all privileges, obviously. But you will likely want to limit privileges under many circumstances. These parameters include selectinsert, and delete.
Choose all that apply and separate by comma:
mysql> grant select, insert, delete, update on db_name.* to 'db_user'@'localhost' identified by 'db_password';
To display the privileges granted to the account that you are using to connect to the server, you can use any of the following statements:
mysql> show grants for os_user;
| Grants for db1_user@%                |
| GRANT USAGE ON *.* TO 'db1_user'@'%' |
1 row in set (0.00 sec)


Popular posts from this blog

rman interview and scenario based questions and answer and also rman(backup and recovery) discussions panel

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

7 Steps to configure BDR replication in postgresql

PostgreSQL Introduction