Lab 3.21 MySQL Database Lab Developing the Tools May 5 th, 2004 Montréal, Québec Dominik Gehl Hôpital Ste-Justine, Montréal.

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizards Guide to PHP by David Lash.
Advertisements

PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
WordPress from Start to Finish Day 1: Installing and Using WordPress Looking at the WordPress database.
MySQL Access Privilege System
Murach’s Java SE 6, C21© 2007, Mike Murach & Associates, Inc.Slide 1.
介紹 元智大學電機工程所 碩士班一年級 蕭觀華 學號 : MySQL 介紹大綱 What is MySQL ? How to install on Linux Tutorial Introduction Database Administration MySQL Perl API Q&A.
NMD202 Web Scripting Week5. What we will cover today PHPmyAdmin Debugging – using print_r Modifying Data PHP (cont.) 4D Methodology File and IO operations.
Let’s try Oracle. Accessing Oracle The Oracle system, like the SQL Server system, is client / server. For SQL Server, –the client is the Query Analyser.
Oracle SQL*plus John Ortiz. Lecture 10SQL: Overview2 Overview  SQL: Structured Query Language, pronounced S. Q. L. or sequel.  A standard language for.
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2010 All Rights Reserved. 1.
Project Implementation for COSC 5050 Distributed Database Applications Lab1.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
MySQL Dr. Hsiang-Fu Yu National Taipei University of Education
CSCI 6962: Server-side Design and Programming
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Preliminary Definitions MySQL: An Open Source, Enterprise-level, multi-threaded, relational database management system that stores and retrieves data using.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
7/8/05MySQL David Lawrence1 David Lawrence, JLab An introduction for the novice.
1 Chapter 8 – Working with Databases spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
Advanced Database Management System Lab no. 11. SQL Commands (for MySQL) –Update –Replace –Delete.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Web Application Development. Define ER model in QSEE Generate SQL Create Database mySQL Write Script to use TableEditor class Process to create A simple.
Web Application Development. Tools to create a simple web- editable database QSEE MySQL (or PHPMyAdmin) PHP TableEditor.
EXtensible Neuroimaging Archive Toolkit (XNAT) Washington University Neuroinformatics Group.
Information Systems Today (©2006 Prentice Hall) MySQL 1CS3754 Class Note #8, Is an open-source relational database management system 2.Is fast and.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
MySQL. MySQL is a Relational Database Management System (RDBMS) that runs as a server providing multiuser access to a number of databases. A third party.
CSC 411/511: DBMS Design Dr. Nan WangCSC411_L12_JDBC_MySQL 1 MySQL and JDBC.
ITN Wake Tech1 ITN270 Advanced Internet Databases Lecture 15. General MySQL Administration Topics: –Securing a New MySQL Installation –MySQL Server.
Introduction to MySQL Lab no. 10 Advance Database Management System.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database.
Database and mySQL Week 07 Dynamic Web TCNJ Jean Chu.
CSE 3330 Database Concepts Stored Procedures. How to create a user CREATE USER.. GRANT PRIVILEGE.
Database control Introduction. The Database control is a tool that used by the database administrator to control the database. To enter to Database control.
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2015, Fred McClurg, All Rights.
MySQL Database Connection
Chapter 5 MYSQL Database. Introduction to MYSQL MySQL is the world's most popular open-source database. Open source means that the source code, the programming.
A Brief Documentation.  Provides basic information about connection, server, and client.
Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting MySQL – Inserting Data.
SQL Structured Query Language 1. Data Definition Language (DDL) is used to manage table and define data structure i.e. CREATE, ALTER, DROP Data Control.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
MySQL Quick Guide. Start and End MySQL MySQL is installed as a service. To start MySQL: –Control Panel/Administrative Tools/Services/MySQL/ start MySQL.
Database server Campus-Booster ID : ****** Copyright © SUPINFO. All rights reserved MySQL.
PhpMyAdmin Matthew Walsh April 28, 2003 CMSC Shawn Sivy.
CHAPTER 10 PHP MySQL Database
VIRTUAL HOSTING WITH PureFTPd And MYSQL (Quota And Bandwidth Management) BY Odoh Kenneth Emeka Sun Yu Patrick Appiah.
MySQL MySQL and PHP – interacting with a database.
There are two types of MySQL instructions (Data Definition Language) DDL: Create database, create table, alter table,,,. (Data Manipulation Language) DML.
Introduction to MySQL Ullman Chapter 4. Introduction MySQL most popular open-source database application Is commonly used with PHP We will learn basics.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
Settings MySQL Database and JDBC configuration Instructor: Sergey Goldman.
Databases and SQL CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Introduction to MySQL  Working with MySQL and MySQL Workbench.
Software-Projekt 2008 Seminarvortrag“Short tutorial of MySql“ Wei Chen Verena Honsel.
WMarket For Adminstrators Manual Installation. Basic Dependencies To install your own WMarket instance, you are required to install the following software:
Slide Set #24: Database security SY306 Web and Databases for Cyber Operations.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Intro to MySQL.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
Database Programming Basic JDBC Programming Concepts.
Unix System Administration
Chapter 8 Working with Databases and MySQL
MySQL Dr. Hsiang-Fu Yu National Taipei University of Education
SiteBuilder 2 Introduction.
MSIS 655 Advanced Business Applications Programming
8 6 MySQL Special Topics A Guide to MySQL.
MySQL Database System Installation Overview SQL summary
Presentation transcript:

Lab 3.21 MySQL Database Lab Developing the Tools May 5 th, 2004 Montréal, Québec Dominik Gehl Hôpital Ste-Justine, Montréal

Lab 3.22 Lab Objectives Connect to a MySQL server through –MySQL client –PHPMyAdmin –Java (MySQL Connector/J) Write SQL queries –Manage MySQL user rights –Data definition ( CREATE TABLE etc.) –Data manipulation ( SELECT, INSERT etc.) Exercise: Golub dataset

Lab 3.23 Lab Outline MySQL Command Line client Manage MySQL user rights PHPMyAdmin Data Modeling for the Golub dataset Exercise: –Creating the Golub database –Use Java/JDBC to connect to the Golub database

Lab 3.24 MySQL Command Line Client The standard MySQL client is mysql. It is completely command line based. The most used options are –-h indicate the host to which you want to connect –-u indicate your username (if different from login) –-p you must use a password to connect To connect as database administrator: mysql –h localhost –u root --socket=/tmp/mysql.sock -p

Lab 3.25 MySQL Client

Lab 3.26 MySQL Client – First Commands Connect by using mysql –u root --socket=/tmp/mysql.sock Show all databases show databases; Use a specific database use mysql; Show all tables in this database show tables;

Lab 3.27.my.cnf If you don’t want to indicate your connection parameters every time on the command line, you can create a.my.cnf file Complete documentation is available at Example [client] password=“secret” host=“localhost” socket=“/tmp/mysql.sock” user=“login”

Lab 3.28 Backup and Restore Create a backup of MySQL database: mysqldump dbName > fileName.sql Restore –From the Unix command line mysql dbName < fileName.sql –From inside MySQL source fileName.sql

Lab 3.29 Lab Outline MySQL Command Line client Manage MySQL User Rights PHPMyAdmin Data Modeling for the Golub dataset Exercise: –Creating the Golub database –Use Java/JDBC to connect to the Golub database

Lab Manage MySQL User Rights MySQL is a multi-user database server: different users can have different access rights to different databases Take advantage of it: create several users and give only minimal privileges ! The command to create new users is GRANT

Lab GRANT Create a new user for the golub database GRANT ALL PRIVILEGES ON golub.* TO IDENTIFIED BY ‘your_password’ Create a new user for the golub database having on ‘select’ rights GRANT SELECT ON golub.* TO

Lab Changing Passwords MySQLAdmin mysqladmin –u myUser –p password ‘newPwd’ By entering directly the mysql database UPDATE user SET password=password(‘secret’) WHERE user=‘myUser’; FLUSH PRIVILEGES;

Lab Lab Outline MySQL Command Line client Manage MySQL User Rights PHPMyAdmin Data Modeling for the Golub dataset Exercise: –Creating the Golub database –Use Java/JDBC to connect to the Golub database

Lab PHPMyAdmin PHPMyAdmin is a web application (written in PHP) to facilitate MySQL administration Available at Features: –Create / modify databases / tables –Import / export data –Manage MySQL users –Create PDF database schemata

Lab 3.215

Lab Database Schema

Lab PHPMyAdmin Configuration Configuration is explained in the Documentation.txt file Major configuration steps –Download from –Extract files from downloaded archive –Install the distribution in a directory accessible to the web server –Edit the config.inc.php file –Create an auxiliary database and MySQL user

Lab config.inc.php $cfg['PmaAbsoluteUri'] = ' $cfg['blowfish_secret'] = 'secret'; $cfg['Servers'][$i]['controluser'] = 'phpmyadmin'; $cfg['Servers'][$i]['controlpass'] = 'secret'; $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; $cfg['Servers'][$i]['relation'] = 'pma_relation'; $cfg['Servers'][$i]['table_info'] = 'pma_table_info'; $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; $cfg['Servers'][$i]['history'] = 'pma_history';

Lab Create auxiliary MySQL User GRANT USAGE ON mysql.* TO IDENTIFIED BY 'secret'; GRANT SELECT ( Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv) ON mysql.user TO GRANT SELECT ON mysql.db TO GRANT SELECT ON mysql.host TO GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv) ON mysql.tables_priv TO GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO

Lab Create auxiliary Database Database used to store information needed by PHPMyAdmin (pdf, table relations, history etc.) Example script: CREATE DATABASE phpmyadmin; USE phpmyadmin; CREATE TABLE `pma_bookmark` (... ) TYPE=MyISAM CREATE TABLE `pma_relation` (... ) TYPE=MyISAM CREATE TABLE `pma_table_info` (... ) TYPE=MyISAM CREATE TABLE `pma_table_coords` (... ) TYPE=MyISAM CREATE TABLE `pma_pdf_pages` (... ) TYPE=MyISAM CREATE TABLE `pma_column_info` (... ) TYPE=MyISAM CREATE TABLE `pma_history` (... ) TYPE=MyISAM

Lab PHPMyAdmin - The Fun Part PHPMyAdmin is already installed ! You don’t have to configure it yourself today … If you want to have a look at the source code, it’s available at /opt/diro/phpMyAdmin

Lab Lab Outline MySQL Command Line client Manage MySQL User Rights PHPMyAdmin Data Modeling for the Golub dataset Exercise: –Creating the Golub database –Use Java/JDBC to connect to the Golub database

Lab Data Modeling We want to create a database for the golub dataset. What does the dataset look like ? table_ALL_AML_samples.txt data_set_ALL_AML_train.txt What tools are available to help us modeling (and avoid writing ‘CREATE TABLE’ statements) ?

Lab Samples Cancer type Sample Name

Lab Samples Information we are interested in: –Sample Name –Cancer Type Since we can imaging working with several other cancer types and would like to keep some more information on each cancer type, we will create two different tables: –Sample (sample name, cancer class) –Class (cancer class)

Lab Sample Our sample name Our class name Original sample name Original class name

Lab Gene Expression Gene Sample Expression Sample 2

Lab Gene Expression We’ll need again two tables –Gene Gene Name Accession –Expression Sample Name Gene Name Expression value

Lab Complete Database Schema

Lab Creating the database We can now create the MySQL database by typing every CREATE TABLE statement in the command line CREATE TABLE gene ( gene_id int(10) unsigned NOT NULL auto_increment, description varchar(255) default NULL, accession varchar(255) default NULL, PRIMARY KEY (gene_id), KEY accession_idx (accession)) By using tools: –PHPMyAdmin ( ) –DBDesigner 4 ( )

Lab DBDesigner

Lab Lab Outline MySQL Command Line client Manage MySQL User Rights PHPMyAdmin Data Modeling for the Golub dataset Exercise: –Creating the Golub database –Use Java/JDBC to connect to the Golub database

Lab Lab Exercise 1 Finally … Create a user having only rights to the Golub database. Create the Golub database. You can choose if you want to create the database –from the command line –using PHPMyAdmin … or –just using the provided backup

Lab Lab Exercise 2 Create a Java program which obtains, from the Golub database you just created, the gene(s) for which expression >= for the most samples. An example JDBC URL is “jdbc:mysql://localhost/dbName?user=userName&password=secret” Add a possibility for the user to specify an upper and lower threshold on the expression value.