Databases and SQL. Homework. Matthias Danner. June 11, 2013. Matthias Danner Databases and SQL June 11, 2013 1 / 16



Similar documents
Database Administration with MySQL

DBA Tutorial Kai Voigt Senior MySQL Instructor Sun Microsystems Santa Clara, April 12, 2010

Tushar Joshi Turtle Networks Ltd

Databases and SQL. The Bioinformatics Lab SS Wiki topic 10. Tikira Temu. 04. June 2013

StoreGrid Backup Server With MySQL As Backend Database:

Part 3. MySQL DBA I Exam

Monitoring MySQL. Kristian Köhntopp

Full Text Search in MySQL 5.1 New Features and HowTo

MySQL Storage Engines

Upgrading MySQL from 32-bit to 64-bit

SCALABLE DATA SERVICES

Connect to MySQL or Microsoft SQL Server using R

Tier Architectures. Kathleen Durant CS 3200

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

Monitoring PostgreSQL database with Verax NMS

A Brief Introduction to MySQL

Determining your storage engine usage

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

Adept Backup Solution - Configure Database MySQL Backup Schedule How to configure a MySQL Database Backup. Overview.

Performance Tuning and Optimizing SQL Databases 2016

WordPress Security Scan Configuration

Mul$media im Netz (Online Mul$media) Wintersemester 2014/15. Übung 03 (Nebenfach)

8- Management of large data volumes

Synchronous multi-master clusters with MySQL: an introduction to Galera

Using Cacti To Graph MySQL s Metrics

Installation and Deployment

Backup/Restore MySQL Server

Monitoreo de Bases de Datos

Smartphone Pentest Framework v0.1. User Guide

LAB 6: Code Generation with Visual Paradigm for UML and JDBC Integration

IIS SECURE ACCESS FILTER 1.3

User Guide. NAS Compression Setup

How to Connect to CDL SQL Server Database via Internet

Oracle Database 11 g Performance Tuning. Recipes. Sam R. Alapati Darl Kuhn Bill Padfield. Apress*

Asterisk Cluster with MySQL Replication. JR Richardson Engineering for the Masses

How To Manage Myroster Database With Hp And Myroberty

Installation Guide for AmiRNA and WMD3 Release 3.1

Securing and Accelerating Databases In Minutes using GreenSQL

Would-be system and database administrators. PREREQUISITES: At least 6 months experience with a Windows operating system.

MySQL Administration and Management Essentials

QUANTIFY INSTALLATION GUIDE

An Eprints Apache Log Filter for Non-Redundant Document Downloads by Browser Agents

SQL Server Instance-Level Benchmarks with DVDStore

Integrating VoltDB with Hadoop

GroundWork Monitor Open Source Installation Guide

PassMark Software BurnInTest Management Console. Quick start guide

SAM Server Utility User s Guide

Configuring Apache Derby for Performance and Durability Olav Sandstå

MySQL 5.1 INTRODUCTION 5.2 TUTORIAL

Alfresco Enterprise on AWS: Reference Architecture

TO SQL DB. Manual. Page 1 of 7. Manual. Tel & Fax: info@altiliagroup.com Web:

LAMP : THE PROMINENT OPEN SOURCE WEB PLATFORM FOR QUERY EXECUTION AND RESOURCE OPTIMIZATION. R. Mohanty Mumbai, India

MatriXay Database Vulnerability Scanner V3.0

Connect to a SQL Database with Monitouch

Setting up PostgreSQL

Installing and configuring Microsoft Reporting Services

Version of this tutorial: 1.06a (this tutorial will going to evolve with versions of NWNX4)

Setting Up Specify to use a Shared Workstation as a Database Server

Emerald. Network Collector Version 4.0. Emerald Management Suite IEA Software, Inc.

A table is a collection of related data entries and it consists of columns and rows.

THE CLOUD STORAGE ENGINE 1.0. ClouSE

This guide specifies the required and supported system elements for the application.

Database Security. Principle of Least Privilege. DBMS Security. IT420: Database Management and Organization. Database Security.

DOCUMENTATION MySQL BACKUP & RESTORE OPERATIONS

REDCap General Security Overview

Tivoli Monitoring for Databases: Microsoft SQL Server Agent

Partek Flow Installation Guide

Application note: Connecting the to a Database

MySQL Backup and Security. Best practices on how to run MySQL on Linux in a secure way Lenz Grimmer <lenz@mysql.com>

Eurobackup PRO: Configuration Best Practices

DBI-Link: 3.0. PgCon Ottawa 2008 Copyright David Fetter 2008 All Rights Reserved

A Quick Start Guide to Backup Technologies

How to backup a remote MySQL server with ZRM over the Internet

Uptime Infrastructure Monitor. Installation Guide

Testing and Verifying your MySQL Backup Strategy

Database Management System Choices. Introduction To Database Systems CSE 373 Spring 2013

Redundant Storage Cluster

Exadata for Oracle DBAs. Longtime Oracle DBA

Install Cacti Network Monitoring Tool on CentOS 6.4 / RHEL 6.4 / Scientific Linux 6.4

Monitoring MySQL database with Verax NMS

Using Windows Task Scheduler instead of the Backup Express Scheduler

CounterPoint SQL and Magento ecommerce Interface

Encrypting MySQL data at Google. Jonas Oreland and Jeremy Cole

ULTEO OPEN VIRTUAL DESKTOP V4.0

Jason S Wong Sr. DBA IT Applications Manager DBA Developer Programmer M.S. Rice 88, MBA U.H. 94(MIS)

MySQL: Cloud vs Bare Metal, Performance and Reliability

Intro to Databases. ACM Webmonkeys 2011

DiskPulse DISK CHANGE MONITOR

RingStor User Manual. Version 2.1 Last Update on September 17th, RingStor, Inc. 197 Route 18 South, Ste 3000 East Brunswick, NJ

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

Configuring Keystone in OpenStack (Essex)

Scala InfoChannel Content Manager 5 Backup and Restore Instructions

Lenz Grimmer

Enterprise-level EE: Uptime, Speed, and Scale

How To Backup A Database On A Microsoft Powerpoint 3.5 (Mysqldump) On A Pcode (Mysql) On Your Pcode On A Macbook Or Macbook (Powerpoint) On

SAP Business Objects Business Intelligence platform Document Version: 4.1 Support Package Data Federation Administration Tool Guide

Transcription:

Databases and SQL Homework Matthias Danner June 11, 2013 Matthias Danner Databases and SQL June 11, 2013 1 / 16

Install and configure a MySQL server Installation of the mysql-server package apt-get install mysql-server Installed packages libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libnet-daemon-perl libplrpc-perl mysql-client-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5 Matthias Danner Databases and SQL June 11, 2013 2 / 16

Connecting to MySQL and basic database management Connecting to MySQL in Bash mysql -u user -p CREATE USER statement CREATE USER username [INDENTIFIED BY password]; CREATE DATABASE statement CREATE DATABASE databasename; Creating an user and a database CREATE USER u1; CREATE DATABASE db1; Matthias Danner Databases and SQL June 11, 2013 3 / 16

Basic database management GRANT statement GRANT priv type a on {tbl name * *.* db name.*} TO user; a for priv type check http://dev.mysql.com/doc/refman/5.1/en/grant.html Granting u1 full access to db1 GRANT ALL ON db1.* TO u1; Creating a second user and granting read access to db1 CREATE USER u2; GRANT SELECT ON db1.* TO u2; Matthias Danner Databases and SQL June 11, 2013 4 / 16

Basic database management Retrieve the rights of an user SHOW GRANTS FOR user; Remove rights of an user REVOKE priv type ON {tbl name * *.* db name.*} FROM user; Matthias Danner Databases and SQL June 11, 2013 5 / 16

Basic database management CREATE TABLE statement CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl name create definition a a for create definition check http://dev.mysql.com/doc/refman/5.1/en/create-table.html CREATE TABLE with two colums and a primary key that spans over two colums CREATE TABLE t1 (id INT(10) AUTO INCREMENT, int val INT(10), text val VARCHAR(55) NOT NULL, PRIMARY KEY (id, int val)); Matthias Danner Databases and SQL June 11, 2013 6 / 16

Basic database management Access database via Perl #! \ u s r \ b i n \ p e r l w use s t r i c t ; #p e r l package f o r d a t a b a s e c o n n e c t i o n use DBI ; #connect to d a t a b a s e v i a the mysql s o c k e t my $dbh = DBI >connect ( DBI : mysql : db1, u1, ) or die $DBI : : e r r s t r ; #do f u n c t i o n f o r s i m p l e s t a t e m e n t s $dbh >do ( CREATE TABLE t 1 ( i d INT (10) AUTO INCREMENT, i n t v a l INT ( 1 0 ), t e x t v a l VARCHAR( 55) NOT NULL, PRIMARY KEY ( id, i n t v a l ) ) ; ) ; #don t f o r g e t to d i s c o n n e c t ; ) $dbh >d i s c o n n e c t ( ) ; Matthias Danner Databases and SQL June 11, 2013 7 / 16

Basic database management Access database via Perl... my $ s t h = $dbh >p r e p a r e ( SELECT FROM t1 ; ) ; $sth >e x e c u t e ( ) ; while ( $sth >f e t c h r o w a r r a y ( ) { my @ r e s u l t s = $sth >f e t c h r o w a r r a y ( ) }... Matthias Danner Databases and SQL June 11, 2013 8 / 16

Creating a backup from database Creating a backup via mysqldump mysqldump -u user -p databasename >database.backup dumps whole database into one file Creating a backup directly from mysql SELECT * INTO OUTFILE database.backup a FROM table name; a file appears in /var/lib/mysql/db name/ you have to create a file for each table Matthias Danner Databases and SQL June 11, 2013 9 / 16

Questions Display default properties SHOW VARIABLES; a a change variables in /etc/mysql/my.cnf What is the TCP/IP Port the MySQL server/ client applications will listen to? 3306 (port) How many concurrent sessions the MySQL server will allow? 151 (max connections) What is the size of the query cache used to cache SELECT results? 1048576 (query cache limit) Matthias Danner Databases and SQL June 11, 2013 10 / 16

Server status Display server status with bash tool mysqlreport -u user password= Display server status with MySQL built-in method SHOW STATUS; Matthias Danner Databases and SQL June 11, 2013 11 / 16

Advanced Challenge Monitoring of CPU and memory usage Monitoring ps -ax grep mysqld ps -p <pid> -o %cpu,%mem Matthias Danner Databases and SQL June 11, 2013 12 / 16

Advanced Challenge Performance gain via optimization of server variables Server variables key buffer size table cache sort buffer size read buffer size Matthias Danner Databases and SQL June 11, 2013 13 / 16

Advanced Challenge Storage engines MyISAM: high-speed storage, but not transaction-safe MEMORY: creates in-memory tables (fast, not transaction-safe) InnoDB: provides transaction-safe tables CSV: stores data in text files... Matthias Danner Databases and SQL June 11, 2013 14 / 16

References References http://dev.mysql.com/doc/refman/5.1/en/server-systemvariables.html http://dev.mysql.com/doc/refman/5.1/en/create-user.html http://dev.mysql.com/doc/refman/5.1/en/create-database.html http://dev.mysql.com/doc/refman/5.1/en/grant.html http://dev.mysql.com/doc/refman/5.1/en/create-table.html http://sql-info.de/mysql/examples/perl-dbi-examples.html http://dev.mysql.com/doc/refman/5.0/en/server-parameters.html http://dev.mysql.com/doc/refman/5.0/en/storage-engines.html Matthias Danner Databases and SQL June 11, 2013 15 / 16

Thank you for your attention! Matthias Danner Databases and SQL June 11, 2013 16 / 16