Techies Adsense

Monday, 22 August 2016

MySQL Create User with grant options

MySQL Create User with GRANT OPTION.

In this Article I have described Steps by Step how to create user and How to GRANT Privileges In MySQL.


1. To Login into MySQL type: 

$ sudo mysql  
Or
$
mysql -h localhost -u root -p....******
mysql> show databases;+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
mysql>

2. Create MySQL Database

mysql> create database mywebdb;
Press Enter.
Query OK, 0 rows affected (0.00 sec)

 3. Create MySQL User:

mysql> mysql> CREATE USER 'mydbuser'@'localhost' IDENTIFIED BY 'mydbpassword';
mysql>GRANT ALL PRIVILEGES ON mydatabase.* TO 'mydbuser'@'my-host-ip' IDENTIFIED BY 'mydbuserpass';

4. Flush Privileges: 

mysql>>FLUSH PRIVILEGES; 
5. To see user's privileges type:

mysql>select * from mysql.user where User='grabit_web';

6. To see List of MySQL Database's Tables:

mysql> use mydatabs;
mysql> show tables;
Empty set (0.00 sec)


Thanks for the Kind Visit here. 


No comments: