Question

SQL CODE – System Variables System variables can be set via the command line. Please write...

SQL CODE

– System Variables

System variables can be set via the command line. Please write a sequence of statements to:

  • Set safe updates to false for the session.
  • Do the following at the global level:
    • Set the maximum number of connections to 45.
    • Set the threshold for long running queries to 7 seconds – do this at the global level.
    • Set logs to expire when they are more than 3 days old

Write the commands to display the value of the four variables you have updated.

  1. – Managing Users

Write statements that do the following:

    • Create users as follows:
      • Create user daisy with password imadog
      • Create user elmo with password imacat
      • Create user ap_superuser with password imsuper
      • Create user ap_dev with password apdev
      • Create user ap_guest with password apuser
    • Rename user daisy to have username lazydaisy
    • Change password for daisy to be imalazydog
    • Drop user elmo
  • – Granting and Revoking Privileges

Write statements that do the following:

  • Grant privileges to ap_superuser as follows:
    • SELECT/UPDATE/INSERT/DELETE privileges to all tables in ap database
  • Grant privileges to ap_dev as follows:
    • SELECT/UPDATE/INSERT privileges to all tables in ap database
  • Grant privileges to ap_guest as follows:
    • SELECT privileges to all tables
    • UPDATE privileges to VENDORS table only
  • Revoke all privileges from ap_guest
  • Revoke INSERT privileges from ap_dev
  1. – Viewing User and Privilege Information

Write statements to do the following:

  • Display a list of user and host for all users, sort by host, then user.
  • Show grants for the currently logged on user
  • Show privileges for lazydaisy
  • Show privileges for ap_superuser
  • Show privileges for ap_guest
0 0
Add a comment Improve this question Transcribed image text
Answer #1

SQL_SAFE_UPDATES is a system variable.

SET SQL_SAFE_UPDATES=0;
SET GLOBAL long_query_time = 7;

mysql> SET GLOBAL max_connections = 250;

expire_log_days=3

*********************************************************

CREATE USER daisy IDENTIFIED BY imadog
CREATE USER elmo IDENTIFIED BY imacat

CREATE USER ap_superuser IDENTIFIED BY imsuper

CREATE USER ap_dev IDENTIFIED BY apdev

CREATE USER ap_guest IDENTIFIED BY apuser

RENAME USER 'daisy' TO 'lazydaisy';

ALTER USER daisy IDENTIFIED BY imslazydog;

DROP USER 'elmo';

*********************************************************************

GRANT Insert, Select, Update, Delete ON ap database To 'ap-superuser';

GRANT Insert, Select, Update ON ap database To 'ap-dev';

GRANT SELECT ON ap database To 'ap-guest';

GRANT Update ON VENDORS To 'ap-guest';

REVOKE ALL ON ap database FROM  'ap-guest';

REVOKE INSERT ON ap database FROM 'ap-dev';

**********************************************************************************

select User,Host from mysql.user;
SHOW GRANTS FOR CURRENT_USER;
SHOW GRANTS FOR lazydaisy;

SHOW GRANTS FOR ap_superuser ;

SHOW GRANTS FOR 'ap-guest';

Add a comment
Know the answer?
Add Answer to:
SQL CODE – System Variables System variables can be set via the command line. Please write...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • SQL CODE – System Variables System variables can be set via the command line. Please write a sequence of statements to: Set safe updates to false for the session. Do the following at the global level...

    SQL CODE – System Variables System variables can be set via the command line. Please write a sequence of statements to: Set safe updates to false for the session. Do the following at the global level: Set the maximum number of connections to 45. Set the threshold for long running queries to 7 seconds – do this at the global level. Set logs to expire when they are more than 3 days old Write the commands to display the value...

  • Lab 3: Securing the Database Environment You have been hired as the DBA for Haphazard, Inc....

    Lab 3: Securing the Database Environment You have been hired as the DBA for Haphazard, Inc. You are asked to fulfill the following needs of the Database environment. You can choose any database, such as Oracle, MySql, Sqlserver, etc. 1. Users, roles, and privileges need to be added to the database. Identify the statements that would be used for creating the following users, roles, and privileges that match the following requirements: a. Create a user account NLitzinger identified by the...

  • 1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database....

    1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE permission to the new role for the Orders and OrderItems table. Give SELECT permission for all user tables. 2. Write a script that (1) creates a login ID named “RobertHalliday” with the password “HelloBob”; (2) sets the default database for the login to the MyGuitarShop database; (3) creates a user named “RobertHalliday” for the login; and (4) assigns the user...

  • Scenario: In your newly assigned Oracle DBA position, the security audit team wants you to be...

    Scenario: In your newly assigned Oracle DBA position, the security audit team wants you to be involved in a new project to make sure Users are created with Least Privileges, the database uses encryption for all data-at-rest, use separate table spaces for users and applications, user passwords expire on first login, quotas should be used for tablespaces as opposed to unlimited tablespaces, temporary tablespaces should be used to help speed performance, no default user passwords exist in the database, Roles...

  • 1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database....

    1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE permission to the new role for the Orders and OrderItems table. Give SELECT permission for all user tables. 3) Write a script that uses dynamic SQL and a cursor to loop through each row of the Administrators table and (1) create a login ID for each row in that consists of the administrator�s first and last name with no space...

  • Write SQL authorization statements on the employee table as per the following requirements:                           &n

    Write SQL authorization statements on the employee table as per the following requirements:                                                                                            You have three managers with manager1, manager2 and manager3 user ids. All of them are members of the role manager. All managers have the same privileges: select, insert, update, delete. No managers can transfer his privileges on the employee table.

  • Write SQL authorization statements on the employee table as per the following requirements: Employee (id, name,...

    Write SQL authorization statements on the employee table as per the following requirements: Employee (id, name, job_name, dept_name, salary) - You have three managers with manager1, manager2 and manager3 user ids. All of them are members of the role manager. - All managers have the same privileges: select, insert, update, delete. - No managers can transfer his privileges on the employee table.

  • 2. Write a script that implements the following design: In the Downloads table, the user_id and...

    2. Write a script that implements the following design: In the Downloads table, the user_id and product_id columns are the foreign keys. Create these tables in the ex schema. Create the sequences for the user_id, download_id, and product_id columns. Include a PL/SQL script to drop the table or sequence if it already exists. Include any indexes that you think are necessary. 3. Write a script that adds rows to the database that you created in exercise 2. Add two rows...

  • Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username an...

    Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username and password management. You accomplished the tasks with Dictionary or List. Here, use class to design your own data structure to accomplish a similar task. The UD.txt datafile: FIRST NAME, LAST NAME,USERNAME,PASSWORD Sam, DDal,sdd233,Pad231 Dave, Dcon,dcf987, BHYW4fw Dell, Grant,dgr803,Sb83d2d Mike, Kress,mkr212,UNNHS322 Lisa,Kate,lki065,dgw6234 Paul,Edward,ped332,9891ds Youyou,Tranten,ytr876,dsid21kk Nomi,Mhanken,nmh223,3282jd3d2 Write a program that imports the database from UD.txt, your program can search for users’ password....

  • please I need help with 1 through 5. Grant the user Kwame the privilege to display...

    please I need help with 1 through 5. Grant the user Kwame the privilege to display (i.e. SELECT) all data for any book in the BOOK table and the privilege to UPDATE the BK_LIST_PRICE only for any book in the BOOK table. Grant the user Kwame the privilege to display (i.e. SELECT) all data for any book in the BOOK table where the PBID = 217; and the privilege to UPDATE the BK_LIST_PRICE only for any book in the BOOK...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT