0% found this document useful (0 votes)
20 views9 pages

EXP10

The document shows the use of MySQL commands to manage databases, tables, users and permissions. A new user 'DBMS' is created and granted privileges on tables. The privileges are later revoked.

Uploaded by

pdacollege9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views9 pages

EXP10

The document shows the use of MySQL commands to manage databases, tables, users and permissions. A new user 'DBMS' is created and granted privileges on tables. The privileges are later revoked.

Uploaded by

pdacollege9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 9

Last login: Sat Mar 23 18:22:24 on ttys000

/Users/abdulladanish/.zshrc:1: command not found: PATH

abdulladanish@Abdullas-MacBook-Air ~ % mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 8.0.36 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+-----------------------+

| Database |

+-----------------------+

| ABDULLA |

| DBMS_EXP4_OPERATORS |

| DBMS_EXP5_JOINS |

| DBMS_EXP8_CONSTRAINTS |

| EXP1 |

| EXP10 |

| information_schema |

| mysql |
| performance_schema |

| PRACTISE |

| sys |

+-----------------------+

11 rows in set (0.02 sec)

mysql> USE EXP10;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> SHOW TABLES;

+-----------------+

| Tables_in_exp10 |

+-----------------+

| DEPT |

| EMP |

+-----------------+

2 rows in set (0.00 sec)

mysql> SELECT * FROM DEPT;

+--------+---------+-----------+

| EMP_ID | DEPT_ID | DEPT_NAME |

+--------+---------+-----------+

| 1 | 123 | CSE |

| 4 | 145 | CSD |

| 1 | 421 | CSD |

| 3 | 465 | CIVIL |
| 2 | 1214 | ME |

+--------+---------+-----------+

5 rows in set (0.00 sec)

mysql> SELECT * FROM EMP;

+--------+----------+

| EMP_ID | EMP_NAME |

+--------+----------+

| 1 | asd |

| 2 | pqr |

| 3 | mno |

| 4 | xyz |

+--------+----------+

4 rows in set (0.01 sec)

mysql> SELECT USER FROM MYSQL.USER;

+------------------+

| USER |

+------------------+

| A1 |

| DANISH |

| TEST |

| USER1 |

| abdulla |

| mysql.infoschema |

| mysql.session |

| mysql.sys |

| root |
+------------------+

9 rows in set (0.00 sec)

mysql> CREATE USER DBMS IDENTIFIED BY '@123';

Query OK, 0 rows affected (0.02 sec)

mysql> GRANT ALL PRIVILEGES ON EMP TO DBMS;

Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON DEPT TO DBMS;

Query OK, 0 rows affected (0.00 sec)

mysql> \q

Bye

abdulladanish@Abdullas-MacBook-Air ~ % mysql -u DBMS -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 9

Server version: 8.0.36 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW DATABASES;

+--------------------+

| Database |

+--------------------+

| EXP10 |

| information_schema |

| performance_schema |

+--------------------+

3 rows in set (0.00 sec)

mysql> USE EXP10;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> SHOW TABLES;

+-----------------+

| Tables_in_exp10 |

+-----------------+

| DEPT |

| EMP |

+-----------------+

2 rows in set (0.00 sec)

mysql> INSERT INTO EMP VALUES(

-> 5,'BILAL');
Query OK, 1 row affected (0.00 sec)

mysql> DELETE FROM EMP WHERE ID = 1;

ERROR 1054 (42S22): Unknown column 'ID' in 'where clause'

mysql> DELETE FROM EMP WHERE EMP_ID = 1;

Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM EMP;

+--------+----------+

| EMP_ID | EMP_NAME |

+--------+----------+

| 2 | pqr |

| 3 | mno |

| 4 | xyz |

| 5 | BILAL |

+--------+----------+

4 rows in set (0.00 sec)

mysql> \q

Bye

abdulladanish@Abdullas-MacBook-Air ~ % mysql -u root -p

Enter password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

abdulladanish@Abdullas-MacBook-Air ~ % mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 11

Server version: 8.0.36 MySQL Community Server - GPL


Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use exp10;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> REVOKE ALL PRIVILEGES ON EMP FROM DBMS;

Query OK, 0 rows affected (0.01 sec)

mysql> REVOKE ALL PRIVILEGES ON DEPT FROM DBMS;

Query OK, 0 rows affected (0.00 sec)

mysql> GRANT SELECT,INSERT,UPDATE ON EMP TO DBMS;

Query OK, 0 rows affected (0.00 sec)

mysql> \q

Bye
abdulladanish@Abdullas-MacBook-Air ~ % mysql -u DBMS -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 12

Server version: 8.0.36 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use exp10;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> delete from EMP where EMP_ID = 5;

ERROR 1142 (42000): DELETE command denied to user 'DBMS'@'localhost' for table
'emp'

mysql> \q

Bye

abdulladanish@Abdullas-MacBook-Air ~ % mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 13


Server version: 8.0.36 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use exp10;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql>

mysql>

mysql> REVOKE SELECT,INSERT,UPDATE ON EMP FROM DBMS;

Query OK, 0 rows affected (0.00 sec)

mysql>

You might also like