Mysql on Windows Gettingstarted Apac v3

download Mysql on Windows Gettingstarted Apac v3

of 65

Transcript of Mysql on Windows Gettingstarted Apac v3

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    1/65

    The webcast will start momentarily.

    Please feel free to ask technical questions using the Q&Abox on the lower-right corner of the screen.

    Welcome to MySQL Webcast

    Windows and MySQL: Getting Started withMySQL on Windows

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    2/65

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    3/65

    Windows and MySQL

    Getting Started with MySQL on Windows

    Mike Frank

    Senior Product Manager for MySQL, Oracle

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    4/65

    Agenda

    Step 1: Download

    Step 2: Installation

    Step 3: Configuration

    Step 4: Starting/Stopping MySQL Service

    Step 5: Sanity Check Step 6: Securing MySQL

    Tools

    Connector

    MySQL & Windows High Availability

    MySQL Resources

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    5/65

    About MySQL

    High Performance Reliable Easy to Use

    14 Years of Development

    400+ in Database Group

    750+ Partners

    70K+ Downloads Per Day

    65% of 14M downloads atmysql.com are for Windows

    Customers across every major operating system, hardware

    vendor, geography, industry, and application type

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    6/65

    Enterprise 2.0TelecommunicationsSaaS, Hosting, Cloud Computing

    Web / Web 2.0 OEM / ISV's

    Serving Key Markets & Industry Leaders

    Open-source Powers the Web

    http://images.google.com/imgres?imgurl=http://www.infinitytechnology.com/uploadedImages/Home/TechFocus_News/AlcatelLucent_Hor_2col_lrg.gif&imgrefurl=http://www.infinitytechnology.com/phonesystems.aspx&h=251&w=720&sz=11&hl=en&start=4&sig2=urYvX47BOQRqvADY_UMA0w&um=1&tbnid=pA91nzVKrUFImM:&tbnh=49&tbnw=140&ei=94SgSOaRCaqkpATZu-jgBw&prev=/images?q=alcatel+lucent&um=1&hl=en&suggon=0&rls=com.microsoft:en-us&sa=N
  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    7/65

    Step1: Download

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    8/65

    MySQL Server Support for Windows

    All current Windows versions

    Windows XP

    Windows Vista

    Windows Server 2003

    Windows Server 2008

    Minimal additional requirements

    32 and 64 bit x86 architectures supported

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    9/65

    Where to download, What to download

    Go to:http://www.mysql.com/downloads/

    Select 32 or 64 bit version depending on your system.

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    10/65

    Download MySQL

    Log in the MySQL account and download. You can registerfrom the New User.

    Or, click No thanks, just take me to the downloads! todownload.

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    11/65

    Installation Packages

    Complete (MSI installer or unzip)

    Essentials Excludes Instance Manager, Documentation, Developer

    Components.

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    12/65

    Select Nearest Mirror and Save File

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    13/65

    Step2: Installation

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    14/65

    Run mysql-essential-5.1.50-win32.msi (or higher version)

    Installing MySQL

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    15/65

    Select type of install

    Developers select Complete DBAs select Typical

    FYI:

    The installer contains the componentsas shown in the list.

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    16/65

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    17/65

    Finish Installation

    Click the Next several times until the

    Wizard Completed screen.

    Click the Finish to complete the

    installation.

    Leave the Configure box checked.

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    18/65

    Step3: Configuration

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    19/65

    On the MySQL Server Instance Configuration Wizard, select theDetailed Configuration and click the Next.

    To re-launch configuration wizard:

    Start->MySQL->MySQL Server 5.1-> MySQL Server Instance Config Wizard

    Configure MySQL Server

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    20/65

    Selecting Configuration Options

    Instance

    a running MySQL Server process

    or a MySQL Windows Service

    Instance features and properties are determined by

    Parameters

    Startup options

    Active (enabled) components

    Configuration file is my.ini

    Located in the MySQL installation directory

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    21/65

    Select appropriate server type.

    For a trial use, use the Developer Machine.

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    22/65

    Perhaps a new concept for some DBAs

    MySQL supports many database storage engines Can all run at the same time on the same MySQL

    Instance

    Select Multifunction

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    23/65

    Select location for InnoDB files

    Performance Tips

    High performance storage?

    Specify drive letter Select a disk that has:

    Space available

    Where OS is not installed

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    24/65

    Set expected connection.

    Default Port 3306

    Use the Strict Mode.

    Strict mode controls how MySQLhandles invalid or missing input values

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    25/65

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    26/65

    Password for MySQL

    root account. Equiv to sa in MSSQL

    NOT an OS account

    Dont forget

    Enable access from

    remote if you plan on

    non-local access.

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    27/65

    Finally, select the Execute and the MySQL Server will

    start up.

    Clicking the Finish completes configuration.

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    28/65

    Step4:

    Starting/Stopping MySQL Service

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    29/65

    At this point, MySQL is installed and started

    as a service.

    Or, from the command line.

    Hint: if you are having any issues append:

    -console

    >"C:\Program Files\MySQL\MySQL Server5.1\bin\mysqld" --defaults-file="C:\Program

    Files\MySQL\MySQL Server 5.1\my.ini

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    30/65

    And another tip.

    If you use the zip, and not the MSI installer:

    Just unzip to install.

    Manually configure MySQL Windows service

    After unziping, execute the command below in bin directory.> mysqld --install

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    31/65

    Step5: Sanity Check

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    32/65

    Command Line

    If you didnt put MySQL your path:>cd \Program Files\MySQL\MySQL Server 5.1\bin

    Connect as root.>mysql u root -p

    -u specifies the user

    -p means password

    >Enter password:

    mysql> show databases;

    ormysql> show databases\g

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    33/65

    Inline Help

    mysql> help;

    More specifics on a particular command, for example for more on

    show or create database, etc.

    mysql> help show;

    mysql> help create;

    mysql> help create database;

    Exit for now

    mysql> exit

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    34/65

    Sample Databases

    Many sample databases available:

    http://dev.mysql.com/doc/#sampledb

    Sakila has many examples.

    Follow the installation steps defined here:

    http://dev.mysql.com/doc/sakila/en/sakila.html#sakila-installation

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    35/65

    Step6: Security

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    36/65

    MySQL Security Model

    MySQL security is based on Access Control Lists (ACLs)

    Connections Queries

    Operations users attempt to perform

    SSL-encrypted connections supported between MySQLclients and servers

    MySQL bundled with yaSSL in version 5.0.10 and up

    OpenSSL also supported

    More info about SSL connections:

    http://dev.mysql.com/doc/refman/5.0/en/secure-using-ssl.html

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    37/65

    MySQL Privilege System

    Authenticates a user connecting from a given host

    and associates the user with privileges such as:

    SELECT

    INSERT

    UPDATE

    DELETE

    Ability to have anonymous users

    Privileges for MySQL-specific functions such as:

    LOAD DATA INFILE

    Administrative operations

    Replication

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    38/65

    Connecting to MySQL

    Sample

    Connection

    MySQL client expects connection parameters when

    accessing a MySQL server: Host where the MySQL server is running

    Username

    Password

    C ti t M SQL

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    39/65

    Connecting to MySQL

    [email protected]

    [email protected]

    MySQL considers both your host name and user name

    Dont assume a user name belongs to the same personeverywhere.

    For example: the useruser1 who connects from 192.168.0.10 is

    not necessarily the same user as user1 who connects from

    192.168.0.11

    Note: Wild cards - supports User1@% or User1@'%.xyz.com'

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    40/65

    Two accounts are created with a user name ofroot

    These are super user accounts that can do anything

    The initial rootaccount passwords are blank

    On Windows

    One rootaccount is for connecting from the local host

    The other allows connections from any host

    Account Management: rootAccounts

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    41/65

    MySQL: Tools

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    42/65

    MySQL Workbench

    Development

    SQL Editor - Color Syntax Highlighting Object Management - Import/Export, Browser and Edit

    Connection Management Wizard, Concurrent, SSH Tunnels

    Multi-Pane Results View, In-grid data edits

    Administration Status, Configuration, Start/Stop, Replication

    Users, Security, and Session Management

    Import/Export Dump Files

    Data Modelling

    Visual Design, Forward/Reverse Engineer

    Change Management and Documentation

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    43/65

    Workbench includes Windows GUI

    Platform Native

    C Core

    Coco, GTK, Win GUI elements as appropriate

    MySQL Native

    Supports all parameters and features of the current anddevelopment server versions

    Native Connections

    TCP/IP

    Sockets / Named Pipes SSH

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    44/65

    MySQL Enterprise Monitor

    Licensed via MySQL Enterprise Subscription

    Monitors and alerts you to potential problems (Web UI) Query Analyzer component that makes perf tuning SQL

    easier

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    45/65

    Connecting from UIs

    Hint

    Connection Name its just a label nothing technicalConnection Methods TCP/IP is typical

    Schema == Database

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    46/65

    MySQL: Connectors

    C t /ODBC

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    47/65

    Connector/ODBC

    Download the ODBC driver.http://dev.mysql.com/downloads/connector/odbc/5.1.html#win32

    ODBC will let you use MySQL as a database and thus

    via MS Office products like Access or Excel

    Run the installer

    Select Complete to get the driver and documentation

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    48/65

    Step 1

    Go to Control Panel,Administrative Tools.

    Run Data Sources (ODBC)

    Click Add,

    Select the MySQL ODBC 5.1 Driver,

    and Finish

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    49/65

    Step 2

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    50/65

    Connector/NET

    Easily create .NET applications. C#,

    ASP.NET

    VB.net

    Connector/Net Implements the ADO.NET interfaces

    Integrates into ADO.NET aware tools.

    Fully managed ADO.NET driver

    100% pure C#.

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    51/65

    Connector/NET Resources

    Visual Studio integrationhttp://dev.mysql.com/doc/refman/5.0/en/connector-net-visual-studio.html

    Connector/Net is available for download at:http://dev.mysql.com/downloads/connector/net/6.0.html

    Exploring MySQL in the Microsoft .NET Environmenthttp://dev.mysql.com/tech-resources/articles/dotnet/index.html

    Using MySQL With .NET/C#/Visual Basic/Powershell.http://dev.mysql.com/usingmysql/dotnet/

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    52/65

    Connector/NET Very Simple C# Example

    1. Create project

    2. Add MySQL Reference

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    53/65

    using System;

    using System.Data;

    using MySql.Data.MySqlClient;

    using System.IO;

    using System.Text;

    namespace ConsoleApplication1{

    class Program

    {

    static void Main(string[] args)

    {

    DataSet myData = new DataSet();MySql.Data.MySqlClient.MySqlConnection conn;

    MySql.Data.MySqlClient.MySqlCommand cmd;

    MySql.Data.MySqlClient.MySqlDataAdapter myAdapter;

    TextWriter stdoutWriter = Console.Out;

    stdoutWriter.WriteLine("MySQL Test");conn = new MySql.Data.MySqlClient.MySqlConnection();

    cmd = new MySql.Data.MySqlClient.MySqlCommand();

    myAdapter = newMySql.Data.MySqlClient.MySqlDataAdapter();

    Connector/NET Very Simple C# Example

    3. Code

    3a. Using

    3b. Main and Declarations

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    54/65

    conn.ConnectionString = "server=127.0.0.1;uid=youruser;" +

    "pwd=yourpassword;database=sakila;";

    try

    {

    cmd.CommandText = "select * from actor";

    cmd.Connection = conn;

    myAdapter.SelectCommand = cmd;

    myAdapter.Fill(myData);

    myData.WriteXml(@"C:\dataset.xml", XmlWriteMode.WriteSchema);

    }

    catch (MySql.Data.MySqlClient.MySqlException ex)

    {

    TextWriter errorWriter = Console.Error;

    errorWriter.WriteLine("MySQL Exception - " +ex.Message);

    }}

    }

    }

    3c. Connect and Runcommands

    Change UID and Password

    Uses Sakila DB

    3d. Handle Errors

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    55/65

    Windows on MySQL

    High Availability and Fault Tolerance

    MySQL Replication

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    56/65

    MySQL Replication

    Benefits

    Reliability, Performance, and Ease of Use

    Enables data from one database server (master) to be

    replicated 1 or more database servers (slaves).

    Asynchronous

    Permanent connections not required

    Updates can be long-distance

    Can replicate

    All or selected databases

    Selected tables

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    57/65

    Wi d Cl t

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    58/65

    Windows Cluster

    High-availability for applications, services and data.

    According to Microsoft

    MySQL can run as a Clustered Service

    Windows Server 2008 Failover Clustering and MySQL

    http://www.mysql.com/why-mysql/white-papers/mysql-wp-windows-cluster.php

    When services are down or fail, business continuity isinterrupted, which can result in significant losses. Windows

    Server 2008 R2 supports many key high-availability features to

    help

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    59/65

    C l i

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    60/65

    Conclusion

    Easy to get started quickly with MySQL on Windows.

    Lots of information, references, and tutorials on the

    MySQL website and on the web

    http://www-jp.mysql.com/why-

    mysql/windows/

    Oth R

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    61/65

    Other Resources

    Deliver MySQL-relatedinformation such as productrelease, seminars, webinars,technical document.

    Subscribe now >> http://www.mysql.com/register/

    Tweet the latest MySQLinformation.

    Follow MySQL on @mysql >> http://twitter.com/mysql

    Additi l R

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    62/65

    Additional Resources

    Getting Started

    http://dev.mysql.com/usingmysql/get_started.html

    Case Studies

    http://www.mysql.com/why-mysql/case-studies/

    White Papers

    http://www.mysql.com/why-mysql/white-papers/

    MySQL Migration Toolkit

    http://www.mysql.com/products/tools/migration-toolkit/

    A Guide to Lower Database TCO, MySQL

    http://www.mysql.com/tco

    M SQL A i P ifi C t t I f ti

    http://www.mysql.com/why-mysql/case-studies/http://www.mysql.com/why-mysql/case-studies/http://www.mysql.com/why-mysql/white-papers/http://www.mysql.com/products/tools/migration-toolkit/http://www.mysql.com/products/tools/migration-toolkit/http://www.mysql.com/products/tools/migration-toolkit/http://www.mysql.com/products/tools/migration-toolkit/http://www.mysql.com/why-mysql/white-papers/http://www.mysql.com/why-mysql/white-papers/http://www.mysql.com/why-mysql/white-papers/http://www.mysql.com/why-mysql/white-papers/http://www.mysql.com/why-mysql/white-papers/http://www.mysql.com/why-mysql/case-studies/http://www.mysql.com/why-mysql/case-studies/http://www.mysql.com/why-mysql/case-studies/http://www.mysql.com/why-mysql/case-studies/http://www.mysql.com/why-mysql/case-studies/http://www.mysql.com/why-mysql/case-studies/
  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    63/65

    MySQL Asia Pacific Contact Information

    By Phone: Oracle Direct (Toll Free)http://www.mysql.com/about/contact/apac.html

    Australia: 1300 366 386 New Zealand: 0508 555 215

    Hong Kong: 800 901 039

    Macau: 0800 341

    Brunei: 800 065 then dial 6436 2417

    Indonesia: 0800 1672 253

    Japan: 0120 155 096

    Malaysia: 1800 801 1837

    Philippines: 811 5831

    Singapore: 1800 672 2531

    Sri Lanka / Colombo Metropolitan Area: 2430 0800 then dial 6436 2419

    Sri Lanka / Other Areas: 11 2430 0800 then dial 643 62419

    Thailand: 1 800 441 0545

    By Email: [email protected]

    Online Contact form: http://www.mysql.com/about/contact/

    mailto:[email protected]:[email protected]:[email protected]:[email protected]
  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    64/65

    Thanks for attending!

  • 8/8/2019 Mysql on Windows Gettingstarted Apac v3

    65/65