SlideShare a Scribd company logo
MySQL Tutorial
MySQL Architecture
Common Tools
Examples
MySQL Overview
What is MySQL?
MySQL, the most popular Open Source SQL database management system, is developed,
distributed, and supported by MySQL AB. MySQL AB is a commercial company, founded in 1995 by
the MySQL developers. It is a second generation Open Source company that unites Open Source
values and methodology with a successful business model.
The MySQL® software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured
Query Language) database server. MySQL Server is intended for mission-critical, heavy-load
production systems as well as for embedding into mass-deployed software. MySQL is a registered
trademark of MySQL AB.
The MySQL software is Dual Licensed. Users can choose to use the MySQL software as an Open
Source product under the terms of the GNU General Public License or can purchase a standard
commercial license from MySQL AB.
The company name was given after co-founder Monty Widenius's daughter, My, the SQL is
“Structured Query Language.”, AB is Sweedish for limited partnership.
wits
MySQL Overview
What does it do?
MySQL is a database management system.
A database is a structured collection of data. To add, access, and process data stored in a computer database, you need a database management system such as MySQL
Server.
MySQL is a relational database management system.
A relational database stores data in separate tables rather than putting all the data in one big storeroom. This adds speed and flexibility. The SQL part of “MySQL” stands
for “Structured Query Language.”
MySQL software is Open Source.
Open Source means that it is possible for anyone to use and modify the software. Anybody can download the MySQL software from the Internet and use it without paying
anything. If you wish, you may study the source code and change it to suit your needs. If you want to redistribute altered versions MySQL, other licences are available
MySQL Server works in client/server or embedded systems.
The MySQL Database Software is a client/server system that consists of a multi-threaded SQL server that supports different backends, several different client programs
and libraries, administrative tools, and a wide range of application programming interfaces (APIs).
A large amount of contributed MySQL software is available.
MySQL is a widely supported database, and very likely that most of your applications supports it.
wits
MySQL Architecture
Three layer model:
The application layer contains common network
services for connection handling, authentication and
security. This layer is where different clients interact with
MySQL these clients can written in different API's:.NET,
Java, C, C++, PHP, Python, Ruby, Tcl, Eiffel, etc...
The Logical Layer is where the MySQL intelligence
resides, it includes functionality for query parsing, analysis,
caching and all built-in functions (math, date...). This layer
also provides functionality common across the storage
engines.
The Physical Layer is responsible for storing and
retrieving all data stored in “MySQL”. Associated with this
layer are the storage engines, which MySQL interacts with
very basic standard API's. Each storage engine has it
strengths and weakness, some of this engines are
MyISAM, InnoDB, CSV, NDB Cluster, Falcon, etc...
wits
MySQL Architecture
Some internal components:
Each client connection gets its own thread within the server
process.
When clients (applications) connect to the MySQL server, the server
needs to authenticate them.
Before even parsing the query, though, the server consults the
query cache, which only stores SELECT statements, along with
their result sets.
The storage engine does affect how the server optimizes query.
MySQL Architecture
Transactional properties (ACID):
MySQL Innodb storage engine fully supports transactions, a transaction can be viewed as a block of
instructions that act are applied coherently to the database, in turn this means ACID standard compliance:
Atomicity : Each transaction block is treated as a single instruction, all of the block must succeed or none.
Consistency : Only valid data is written to the database, and the resulting state is valid.
Isolation : While performing operations in a transaction block, other transactions don't see our changes.
Durability : If the transaction returns a successful state it is persisted to the database.
MySQL Architecture
Storage engines:
MySQL supports several storage engines that act as handlers for different table types. MySQL storage
engines include both those that handle transaction-safe tables and those that handle non-transaction-
safe tables.
MySQL Installation
Windows Installation wizard: http://dev.mysql.com/downloads/mysql/5.1.html#win32
Linux:
Debian Based: apt-get install mysql-server-5.0
RPM based: rpm -ivh MySQL-server-*5.1.31-0.rhel3.i386.rpm
YUM Based: yum install mysql-sever
Gentoo Based: emerge mysql
Macintosh:
http://dev.mysql.com/downloads/mysql/5.1.html#macosx
All in One Packages
MAMP – Macintosh Apache MySQL and PHP
http://www.mamp.info/en/index.php
WAMP – Windows Apache MySQL and PHP
http://www.wampserver.com/en/
MySQL Overview
MySQL Files:
wits
In Linux the configuration file is typically located at /etc/mysql/my.cnf, but may vary for
the different Linux flavours, this also applies to the database files them selves which are
located in the /var/lib/MySQL.
Regardless of the storage engine, every MySQL table you create is represented, on disk, by
a .frm file, which describes the table’s format (i.e. the table definition). The file bears the
same name as the table, with a .frm extension. The .frm format is the same on all
platforms but in the description of the .frm format that follows, the examples come from
tables created under the Linux operating system.
/var/lib/mysql/db.frm #Table definition
/var/lib/mysql/db.MYD #MyISAM data file
/var/lib/mysql/db.MYI #MyISAM Index file
/var/lib/mysql/ibdata1 #Innodb data file
MySQL
Command Line tools
On Linux the a user can interact with MySQL using the command line,
in this interaction a user can create, update, delete and modify a
MySQL database using the following command line tools
mysql: general database and table interaction:
mysql -u username -ppassword -h localhost db_name
mysqldump: database backup
mysqldump db_name > outputfile
mysqlbinlog: binary log processing
mysqlbinlog logfile_1 logfile_2 ... logfile_n > out.sql
mysqlbinlog logfile_1 logfile_2 ... logfile_n | mysql
mysql_install_db: database restore
mysql_install_db
MySQL Graphical tools
MySQL administrator
Multi plataform, administration tool
allows to:
•Manage users
•Manage databases and tables
•Perform maintenance tasks
•See server status
MySQL Graphical tools
MySQL query browser
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
MySQL query browser is
a simple query tool used
to interact with a MySQl
database.
MySQL Graphical tools
phpmyadim
Phpmyadmin is a browser
tool developed in php,
that allows you to
manage a mysql
database.
MySQL and Gaia
DbBenchmark is a simple java application that makes use of GaiaTools
(currently outdated), and performs a series of standard tests.
Class mapping:
mdb.properties
test control:
dbbenchmark.properties.mysql_elem
gaia.cu1.tools.db.username=username
gaia.cu1.tools.db.password=password
gaia.cu1.tools.db.driver=com.mysql.jdbc.Driver
gaia.cu1.tools.db.url=jdbc:mysql://localhost:3306/gaia_test?rewriteBatchedStatements=true
Running the tests:
ant mysql_elem_random
DbBenchmark
MySQL and Gaia
MDBIngestorExtractor is a application that allows the extraction
and ingestion “gbin” files, which are
Class mapping:
conf/mdb.properties
MDB Extractor Ingestor properties:
conf/ingestor.properties
conf/extractor.properties
gaia.cu1.tools.db.username=username
gaia.cu1.tools.db.password=password
gaia.cu1.tools.db.url=jdbc:mysql://localhost:3306/test
gaia.cu1.tools.db.driver=com.mysql.jdbc.Driver
Lauching the extactor/ingestor:
bash ingest.sh
bash extract.sh
MDBIngestorExtractor
MySQL queries
Create a database:
create database database_name;
Display databases:
show databases;
Selecting a database
use database_name
Display tables:
show tables
Create a table:
create table create table person
(id int, person varchar (32) )
engine=engine_name
Deleting a table:
Drop table table_name
Insert a value in a table:
Insert into table_name.db_name
(field1 , field 2...) Values (v1, v2, ...), (v1',v2');
View data all data in a table:
select * from table name where cond = value
Select data from two different tables:
Select field1, field2 from tbl1, tbl2 where
field3= field4;
Sow create table statement:
show create table tbl_name
Show database variables:
show variables;
Q&A
•Books:
OreIlly High Performance MySQL Second Edition Jun 2008
OReilly MySQL in a Nutshell 2nd Edition
More on MySQL-cluster and other studies:
SIM Studies at the GAIA WIKI
The technical note:
GAIA-C1-TN-SIM-CDJ-001-1.pdf
GAIA-C1-TN-SIM-AAB-001-01.pdf
MySQL Graphical tools
phpmysqladmin and foreign keys
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
MySQL Graphical tools
phpmysqladmin and foreign keys
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
MySQL Graphical tools
Phpmyadmin and foreign keys
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
MySQL Graphical tools
phpmyadmin and foreign keys
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
MySQL Graphical tools
phpmyadmin and foreign keys
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
MySQL Graphical tools
phpmyadmin and foreign keys
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
MySQL Graphical tools
phpmyadmin and foreign keys
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
MySQL Graphical tools
phpmyadmin and foreign keys
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
MySQL Graphical tools
phpmyadmin and foreign keys
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
MySQL Graphical tools
phpmyadmin and foreign keys
António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09

More Related Content

What's hot

24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
SpanishPASSVC
 
MySQL Reference Manual
MySQL Reference ManualMySQL Reference Manual
MySQL Reference Manual
webhostingguy
 
SQL Server Developer 70-433
SQL Server Developer 70-433SQL Server Developer 70-433
SQL Server Developer 70-433
jasonyousef
 
My SQL conceptual architecture
My SQL conceptual architectureMy SQL conceptual architecture
My SQL conceptual architecture
M Vinay Kumar
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
Stanley Huang
 
Mysql Replication Excerpt 5.1 En
Mysql Replication Excerpt 5.1 EnMysql Replication Excerpt 5.1 En
Mysql Replication Excerpt 5.1 En
liufabin 66688
 

What's hot (19)

Rise of NewSQL
Rise of NewSQLRise of NewSQL
Rise of NewSQL
 
MySQL database
MySQL databaseMySQL database
MySQL database
 
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
 
Slides
SlidesSlides
Slides
 
Using MySQL Meta Data Effectively
Using MySQL Meta Data EffectivelyUsing MySQL Meta Data Effectively
Using MySQL Meta Data Effectively
 
MySQL DBA OCP 1Z0-883
MySQL DBA OCP 1Z0-883MySQL DBA OCP 1Z0-883
MySQL DBA OCP 1Z0-883
 
MySQL Reference Manual
MySQL Reference ManualMySQL Reference Manual
MySQL Reference Manual
 
SQL Server Developer 70-433
SQL Server Developer 70-433SQL Server Developer 70-433
SQL Server Developer 70-433
 
Relational RDBMS : MySQL, PostgreSQL and SQL SERVER
Relational RDBMS  : MySQL, PostgreSQL and SQL SERVERRelational RDBMS  : MySQL, PostgreSQL and SQL SERVER
Relational RDBMS : MySQL, PostgreSQL and SQL SERVER
 
Mysqlppt3510
Mysqlppt3510Mysqlppt3510
Mysqlppt3510
 
My SQL conceptual architecture
My SQL conceptual architectureMy SQL conceptual architecture
My SQL conceptual architecture
 
HPE NonStop SQL WebDBS - Introduction
HPE NonStop SQL WebDBS - IntroductionHPE NonStop SQL WebDBS - Introduction
HPE NonStop SQL WebDBS - Introduction
 
Session 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufSession 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian Malbeuf
 
Oracle database introduction
Oracle database introductionOracle database introduction
Oracle database introduction
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
 
Tutorial MySQL com Java
Tutorial MySQL com JavaTutorial MySQL com Java
Tutorial MySQL com Java
 
Mysql Replication Excerpt 5.1 En
Mysql Replication Excerpt 5.1 EnMysql Replication Excerpt 5.1 En
Mysql Replication Excerpt 5.1 En
 
The Microsoft SQL Server: An Introductory Guide
The Microsoft SQL Server:  An Introductory GuideThe Microsoft SQL Server:  An Introductory Guide
The Microsoft SQL Server: An Introductory Guide
 
working with database using mysql
working with database using mysql working with database using mysql
working with database using mysql
 

Viewers also liked

2015 0723 WHY I LOVE BRUNETTES Chapter 2 LIIN
2015 0723 WHY I LOVE BRUNETTES Chapter 2 LIIN2015 0723 WHY I LOVE BRUNETTES Chapter 2 LIIN
2015 0723 WHY I LOVE BRUNETTES Chapter 2 LIIN
Christian Gehman
 
MONDAY OVIAWE new cv
MONDAY OVIAWE new cvMONDAY OVIAWE new cv
MONDAY OVIAWE new cv
Monday Oviawe
 
Holiday Knack resume 01-27-14
Holiday Knack resume 01-27-14Holiday Knack resume 01-27-14
Holiday Knack resume 01-27-14
Knack Holiday
 
Djinovic_biblio_31072015
Djinovic_biblio_31072015Djinovic_biblio_31072015
Djinovic_biblio_31072015
Marko Djinovi?
 
M.Johnston PhD Thesis Final proof 2014
M.Johnston PhD Thesis Final proof 2014M.Johnston PhD Thesis Final proof 2014
M.Johnston PhD Thesis Final proof 2014
Michael Johnston
 

Viewers also liked (15)

Email field guide
Email field guideEmail field guide
Email field guide
 
Bassem.Iskandar
Bassem.IskandarBassem.Iskandar
Bassem.Iskandar
 
2015 0723 WHY I LOVE BRUNETTES Chapter 2 LIIN
2015 0723 WHY I LOVE BRUNETTES Chapter 2 LIIN2015 0723 WHY I LOVE BRUNETTES Chapter 2 LIIN
2015 0723 WHY I LOVE BRUNETTES Chapter 2 LIIN
 
MONDAY OVIAWE new cv
MONDAY OVIAWE new cvMONDAY OVIAWE new cv
MONDAY OVIAWE new cv
 
4.4 final slide show
4.4 final slide show4.4 final slide show
4.4 final slide show
 
SDN and NFV в банковской сфере
SDN and NFV в банковской сфереSDN and NFV в банковской сфере
SDN and NFV в банковской сфере
 
4.4 final slide show
4.4 final slide show4.4 final slide show
4.4 final slide show
 
ACE Forums 2015
ACE Forums 2015ACE Forums 2015
ACE Forums 2015
 
Holiday Knack resume 01-27-14
Holiday Knack resume 01-27-14Holiday Knack resume 01-27-14
Holiday Knack resume 01-27-14
 
Concurso: "Conoce la historia de ACE GROUP en Latinoamérica"
Concurso: "Conoce la historia de ACE GROUP en Latinoamérica" Concurso: "Conoce la historia de ACE GROUP en Latinoamérica"
Concurso: "Conoce la historia de ACE GROUP en Latinoamérica"
 
Fintech Frenzy: Is this the next bubble?
Fintech Frenzy: Is this the next bubble?Fintech Frenzy: Is this the next bubble?
Fintech Frenzy: Is this the next bubble?
 
Djinovic_biblio_31072015
Djinovic_biblio_31072015Djinovic_biblio_31072015
Djinovic_biblio_31072015
 
M.Johnston PhD Thesis Final proof 2014
M.Johnston PhD Thesis Final proof 2014M.Johnston PhD Thesis Final proof 2014
M.Johnston PhD Thesis Final proof 2014
 
Gesture recognition
Gesture recognitionGesture recognition
Gesture recognition
 
Computational approaches on PBP
Computational approaches on PBPComputational approaches on PBP
Computational approaches on PBP
 

Similar to My sql basic

Mysqlppt3510
Mysqlppt3510Mysqlppt3510
Mysqlppt3510
Anuja Lad
 
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdfCompare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
arihantplastictanksh
 
Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
Jakir Hossain
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
webhostingguy
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
webhostingguy
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
webhostingguy
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
webhostingguy
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
webhostingguy
 
Interfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptxInterfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptx
cavicav231
 

Similar to My sql basic (20)

My First 100 days with a MySQL DBMS (WP)
My First 100 days with a MySQL DBMS (WP)My First 100 days with a MySQL DBMS (WP)
My First 100 days with a MySQL DBMS (WP)
 
SULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpressSULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpress
 
Mysqlppt3510
Mysqlppt3510Mysqlppt3510
Mysqlppt3510
 
My sql università di enna a.a. 2005-06
My sql   università di enna a.a. 2005-06My sql   università di enna a.a. 2005-06
My sql università di enna a.a. 2005-06
 
Mysql tutorial 5257
Mysql tutorial 5257Mysql tutorial 5257
Mysql tutorial 5257
 
Data Base
Data BaseData Base
Data Base
 
My sql crashcourse_intro_kdl
My sql crashcourse_intro_kdlMy sql crashcourse_intro_kdl
My sql crashcourse_intro_kdl
 
Mysql
MysqlMysql
Mysql
 
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdfCompare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
 
Mysql tutorial
Mysql tutorialMysql tutorial
Mysql tutorial
 
Lovely
LovelyLovely
Lovely
 
Case study on mysql in rdbms
Case study on mysql in rdbmsCase study on mysql in rdbms
Case study on mysql in rdbms
 
Data Handning with Sqlite for Android
Data Handning with Sqlite for AndroidData Handning with Sqlite for Android
Data Handning with Sqlite for Android
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
 
Interfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptxInterfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptx
 
Windows server Interview question and answers
Windows server Interview question and answersWindows server Interview question and answers
Windows server Interview question and answers
 

More from Prabhat gangwar

More from Prabhat gangwar (20)

Middleware
MiddlewareMiddleware
Middleware
 
Pseudolocalization
PseudolocalizationPseudolocalization
Pseudolocalization
 
Mule anypoint studio
Mule anypoint studioMule anypoint studio
Mule anypoint studio
 
Mule anypoint platform
Mule anypoint platformMule anypoint platform
Mule anypoint platform
 
What is cluster analysis
What is cluster analysisWhat is cluster analysis
What is cluster analysis
 
clustering and load balancing
clustering and load balancingclustering and load balancing
clustering and load balancing
 
Middleware systems overview and introduction
Middleware systems overview and introductionMiddleware systems overview and introduction
Middleware systems overview and introduction
 
Restful api modeling language
Restful api modeling languageRestful api modeling language
Restful api modeling language
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule fundamentals
Mule fundamentalsMule fundamentals
Mule fundamentals
 
Gsm architecture
Gsm architectureGsm architecture
Gsm architecture
 
Oracle vs-mulesoft-api-manager-features
Oracle vs-mulesoft-api-manager-featuresOracle vs-mulesoft-api-manager-features
Oracle vs-mulesoft-api-manager-features
 
Oracle real application_cluster
Oracle real application_clusterOracle real application_cluster
Oracle real application_cluster
 
Introducing adf business components
Introducing adf business componentsIntroducing adf business components
Introducing adf business components
 
File transfer methods
File transfer methodsFile transfer methods
File transfer methods
 
Ftp tftp
Ftp tftpFtp tftp
Ftp tftp
 
Bpm
BpmBpm
Bpm
 
Global warming
Global warmingGlobal warming
Global warming
 
Seo
SeoSeo
Seo
 
Vedic mathmetics
Vedic mathmeticsVedic mathmetics
Vedic mathmetics
 

Recently uploaded

Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
Avinash Rai
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...The impact of social media on mental health and well-being has been a topic o...
The impact of social media on mental health and well-being has been a topic o...
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
Gyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptxGyanartha SciBizTech Quiz slideshare.pptx
Gyanartha SciBizTech Quiz slideshare.pptx
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Keeping Your Information Safe with Centralized Security Services
Keeping Your Information Safe with Centralized Security ServicesKeeping Your Information Safe with Centralized Security Services
Keeping Your Information Safe with Centralized Security Services
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 

My sql basic

  • 2. MySQL Overview What is MySQL? MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by MySQL AB. MySQL AB is a commercial company, founded in 1995 by the MySQL developers. It is a second generation Open Source company that unites Open Source values and methodology with a successful business model. The MySQL® software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. MySQL is a registered trademark of MySQL AB. The MySQL software is Dual Licensed. Users can choose to use the MySQL software as an Open Source product under the terms of the GNU General Public License or can purchase a standard commercial license from MySQL AB. The company name was given after co-founder Monty Widenius's daughter, My, the SQL is “Structured Query Language.”, AB is Sweedish for limited partnership. wits
  • 3. MySQL Overview What does it do? MySQL is a database management system. A database is a structured collection of data. To add, access, and process data stored in a computer database, you need a database management system such as MySQL Server. MySQL is a relational database management system. A relational database stores data in separate tables rather than putting all the data in one big storeroom. This adds speed and flexibility. The SQL part of “MySQL” stands for “Structured Query Language.” MySQL software is Open Source. Open Source means that it is possible for anyone to use and modify the software. Anybody can download the MySQL software from the Internet and use it without paying anything. If you wish, you may study the source code and change it to suit your needs. If you want to redistribute altered versions MySQL, other licences are available MySQL Server works in client/server or embedded systems. The MySQL Database Software is a client/server system that consists of a multi-threaded SQL server that supports different backends, several different client programs and libraries, administrative tools, and a wide range of application programming interfaces (APIs). A large amount of contributed MySQL software is available. MySQL is a widely supported database, and very likely that most of your applications supports it. wits
  • 4. MySQL Architecture Three layer model: The application layer contains common network services for connection handling, authentication and security. This layer is where different clients interact with MySQL these clients can written in different API's:.NET, Java, C, C++, PHP, Python, Ruby, Tcl, Eiffel, etc... The Logical Layer is where the MySQL intelligence resides, it includes functionality for query parsing, analysis, caching and all built-in functions (math, date...). This layer also provides functionality common across the storage engines. The Physical Layer is responsible for storing and retrieving all data stored in “MySQL”. Associated with this layer are the storage engines, which MySQL interacts with very basic standard API's. Each storage engine has it strengths and weakness, some of this engines are MyISAM, InnoDB, CSV, NDB Cluster, Falcon, etc... wits
  • 5. MySQL Architecture Some internal components: Each client connection gets its own thread within the server process. When clients (applications) connect to the MySQL server, the server needs to authenticate them. Before even parsing the query, though, the server consults the query cache, which only stores SELECT statements, along with their result sets. The storage engine does affect how the server optimizes query.
  • 6. MySQL Architecture Transactional properties (ACID): MySQL Innodb storage engine fully supports transactions, a transaction can be viewed as a block of instructions that act are applied coherently to the database, in turn this means ACID standard compliance: Atomicity : Each transaction block is treated as a single instruction, all of the block must succeed or none. Consistency : Only valid data is written to the database, and the resulting state is valid. Isolation : While performing operations in a transaction block, other transactions don't see our changes. Durability : If the transaction returns a successful state it is persisted to the database.
  • 7. MySQL Architecture Storage engines: MySQL supports several storage engines that act as handlers for different table types. MySQL storage engines include both those that handle transaction-safe tables and those that handle non-transaction- safe tables.
  • 8. MySQL Installation Windows Installation wizard: http://dev.mysql.com/downloads/mysql/5.1.html#win32 Linux: Debian Based: apt-get install mysql-server-5.0 RPM based: rpm -ivh MySQL-server-*5.1.31-0.rhel3.i386.rpm YUM Based: yum install mysql-sever Gentoo Based: emerge mysql Macintosh: http://dev.mysql.com/downloads/mysql/5.1.html#macosx All in One Packages MAMP – Macintosh Apache MySQL and PHP http://www.mamp.info/en/index.php WAMP – Windows Apache MySQL and PHP http://www.wampserver.com/en/
  • 9. MySQL Overview MySQL Files: wits In Linux the configuration file is typically located at /etc/mysql/my.cnf, but may vary for the different Linux flavours, this also applies to the database files them selves which are located in the /var/lib/MySQL. Regardless of the storage engine, every MySQL table you create is represented, on disk, by a .frm file, which describes the table’s format (i.e. the table definition). The file bears the same name as the table, with a .frm extension. The .frm format is the same on all platforms but in the description of the .frm format that follows, the examples come from tables created under the Linux operating system. /var/lib/mysql/db.frm #Table definition /var/lib/mysql/db.MYD #MyISAM data file /var/lib/mysql/db.MYI #MyISAM Index file /var/lib/mysql/ibdata1 #Innodb data file
  • 10. MySQL Command Line tools On Linux the a user can interact with MySQL using the command line, in this interaction a user can create, update, delete and modify a MySQL database using the following command line tools mysql: general database and table interaction: mysql -u username -ppassword -h localhost db_name mysqldump: database backup mysqldump db_name > outputfile mysqlbinlog: binary log processing mysqlbinlog logfile_1 logfile_2 ... logfile_n > out.sql mysqlbinlog logfile_1 logfile_2 ... logfile_n | mysql mysql_install_db: database restore mysql_install_db
  • 11. MySQL Graphical tools MySQL administrator Multi plataform, administration tool allows to: •Manage users •Manage databases and tables •Perform maintenance tasks •See server status
  • 12. MySQL Graphical tools MySQL query browser António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09 MySQL query browser is a simple query tool used to interact with a MySQl database.
  • 13. MySQL Graphical tools phpmyadim Phpmyadmin is a browser tool developed in php, that allows you to manage a mysql database.
  • 14. MySQL and Gaia DbBenchmark is a simple java application that makes use of GaiaTools (currently outdated), and performs a series of standard tests. Class mapping: mdb.properties test control: dbbenchmark.properties.mysql_elem gaia.cu1.tools.db.username=username gaia.cu1.tools.db.password=password gaia.cu1.tools.db.driver=com.mysql.jdbc.Driver gaia.cu1.tools.db.url=jdbc:mysql://localhost:3306/gaia_test?rewriteBatchedStatements=true Running the tests: ant mysql_elem_random DbBenchmark
  • 15. MySQL and Gaia MDBIngestorExtractor is a application that allows the extraction and ingestion “gbin” files, which are Class mapping: conf/mdb.properties MDB Extractor Ingestor properties: conf/ingestor.properties conf/extractor.properties gaia.cu1.tools.db.username=username gaia.cu1.tools.db.password=password gaia.cu1.tools.db.url=jdbc:mysql://localhost:3306/test gaia.cu1.tools.db.driver=com.mysql.jdbc.Driver Lauching the extactor/ingestor: bash ingest.sh bash extract.sh MDBIngestorExtractor
  • 16. MySQL queries Create a database: create database database_name; Display databases: show databases; Selecting a database use database_name Display tables: show tables Create a table: create table create table person (id int, person varchar (32) ) engine=engine_name Deleting a table: Drop table table_name Insert a value in a table: Insert into table_name.db_name (field1 , field 2...) Values (v1, v2, ...), (v1',v2'); View data all data in a table: select * from table name where cond = value Select data from two different tables: Select field1, field2 from tbl1, tbl2 where field3= field4; Sow create table statement: show create table tbl_name Show database variables: show variables;
  • 17. Q&A •Books: OreIlly High Performance MySQL Second Edition Jun 2008 OReilly MySQL in a Nutshell 2nd Edition More on MySQL-cluster and other studies: SIM Studies at the GAIA WIKI The technical note: GAIA-C1-TN-SIM-CDJ-001-1.pdf GAIA-C1-TN-SIM-AAB-001-01.pdf
  • 18. MySQL Graphical tools phpmysqladmin and foreign keys António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
  • 19. MySQL Graphical tools phpmysqladmin and foreign keys António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
  • 20. MySQL Graphical tools Phpmyadmin and foreign keys António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
  • 21. MySQL Graphical tools phpmyadmin and foreign keys António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
  • 22. MySQL Graphical tools phpmyadmin and foreign keys António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
  • 23. MySQL Graphical tools phpmyadmin and foreign keys António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
  • 24. MySQL Graphical tools phpmyadmin and foreign keys António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
  • 25. MySQL Graphical tools phpmyadmin and foreign keys António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
  • 26. MySQL Graphical tools phpmyadmin and foreign keys António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09
  • 27. MySQL Graphical tools phpmyadmin and foreign keys António Amorim, Carlos Jesus. CU1 - DBWorkshop 9-10 /Feb/09