Question

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 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 a sequence of statements to: Set safe updates to false for the session. Do the following at the global level...
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...

    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...

  • 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...

  • Step 1: Create table audits via triggers The system must log any insertion, deletion, or updates...

    Step 1: Create table audits via triggers The system must log any insertion, deletion, or updates to the following tables: • Employee table (project 1) create table Employee ( empNumber char(8) not null, firstName varchar(25) null, lastName varchar(25) null, ssn char(9) null, address varchar(50) null, state char(2) null, zip char(5) null, jobCode char(4) null, dateOfBirth date null, certification bit null, salary money null, constraint PK_EMP PRIMARY KEY(empNumber), constraint EMP_STATECHECK CHECK(state in ('CA','FL')) ) GO • Job table (project 1) create...

  • Please finish all 6 parts with indexing SQL. Don't need to do the measure time things, but you can do it if you wanna do it. Thanks! Write the following SQL queries and measure their execution t...

    Please finish all 6 parts with indexing SQL. Don't need to do the measure time things, but you can do it if you wanna do it. Thanks! Write the following SQL queries and measure their execution time both with and without using indexes 1. Count how many parts in NYC have more than 70 parts on hand 2. Count how many total parts on hand, in both NYC and SFO, are Red 3. List all the suppliers that have more...

  • Please explain each line of code, all code will be in Java. Thank you JKL Restaurant...

    Please explain each line of code, all code will be in Java. Thank you JKL Restaurant maintains a members’ club for its customers.  There are three levels of membership: (1) Basic, (2) Silver, and (3) Gold. A certain member has to be exactly a Basic, Silver, or Gold member at any point in time.  Whenever a member spends money at JKL, he/she gets points and as these points are accumulated, one can redeem one or more $20 dining certificates.  Each Gold member can...

  • * myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following...

    * myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following tables: VENDOR, PRODUCT, CUSTOMER, INVOICE, LINE EMPLOYEE and loads the default data rows */ set echo on; set serveroutput on; select systimestamp from dual; show user; ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'; DROP TABLE LINE CASCADE CONSTRAINTS; DROP TABLE INVOICE CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE VENDOR CASCADE CONSTRAINTS; DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

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