Você está na página 1de 65

Welcome to MySQL Webcast

“Windows and MySQL: Getting Started with


MySQL on Windows”

The webcast will start momentarily.


Please feel free to ask technical questions using the Q&A
box on the lower-right corner of the screen.
<Insert Picture Here>

Windows and MySQL


Getting Started with MySQL on Windows
Mike Frank
Senior Product Manager for MySQL, Oracle
Agenda

• Step 1: Download
<Insert Picture Here>
• 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
About MySQL

• 14 Years of Development
• 400+ in Database Group
• 750+ Partners
• 70K+ Downloads Per Day
• 65% of 14M downloads at
mysql.com are for Windows

Customers across every major operating system, hardware


vendor, geography, industry, and application type

High Performance ▪ Reliable ▪ Easy to Use


Serving Key Markets & Industry Leaders

Web / Web 2.0 OEM / ISV's

SaaS, Hosting, Cloud Computing Telecommunications Enterprise 2.0

Open-source Powers the Web


<Insert Picture Here>

Step1: Download
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


Where to download, What to download
• Go to:
http://www.mysql.com/downloads/
• Select 32 or 64 bit version depending on your system.
Download MySQL
• Log in the MySQL account and download. You can register
from the “New User”.
• Or, click “» No thanks, just take me to the downloads! ” to
download.
Installation Packages

• Complete (MSI installer or unzip)


• Essentials
– Excludes Instance Manager, Documentation, Developer
Components.
Select Nearest Mirror and Save File
<Insert Picture Here>

Step2: Installation
Installing MySQL

• Run mysql-essential-5.1.50-
win32.msi (or higher version)
• Select type of install…
– Developers select “Complete”
– DBAs select “Typical”

FYI:
The installer contains the components
as shown in the list.
Finish Installation
• Click the “Next ” several times until the
“ Wizard Completed “ screen.
• Click the “Finish” to complete the
installation.
• Leave the “Configure” box checked.
<Insert Picture Here>

Step3: Configuration
Configure MySQL Server
On the MySQL Server Instance Configuration Wizard, select the
“Detailed Configuration” and click the “Next”.

To re-launch configuration wizard:


Start->MySQL->MySQL Server 5.1-> MySQL Server Instance Config Wizard
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
• Select appropriate server type.
• For a trial use, use the “Developer Machine”.
• 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
• 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
• Set expected connection.

• Default Port – 3306


• Use the Strict Mode.

Strict mode controls how MySQL


handles invalid or missing input values
• Password for MySQL
“root” account.
• Equiv to “sa” in MSSQL
• NOT an OS account
• Don‟t forget

• Enable access from


remote if you plan on
non-local access.
• Finally, select the “Execute” and the MySQL Server will
start up.
• Clicking the “Finish” completes configuration.
<Insert Picture Here>

Step4:
Starting/Stopping MySQL Service
At this point, MySQL is installed and started
as a service.

Or, from the command line.

>"C:\Program Files\MySQL\MySQL Server


5.1\bin\mysqld" --defaults-file="C:\Program
Files\MySQL\MySQL Server 5.1\my.ini“
Hint: if you are having any issues append:
–-console
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
<Insert Picture Here>

Step5: Sanity Check


Command Line
• If you didn‟t 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: <YOUR PASSWORD>

mysql> show databases;


or
mysql> show databases\g
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
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
<Insert Picture Here>

Step6: Security
MySQL Security Model

• MySQL security is based on Access Control Lists (ACLs)


– Connections
– Queries
– Operations users attempt to perform

• SSL-encrypted connections supported between MySQL


clients 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
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
Connecting to MySQL

• MySQL client expects connection parameters when


accessing a MySQL server:
– Host where the MySQL server is running
– Username
– Password

Sample
Connection
Connecting to MySQL

• MySQL considers both your host name and user name


– Don‟t assume a user name belongs to the same person
everywhere.
– For example: the user user1 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'

user1@192.168.0.10

user1@192.168.0.11
Account Management: root Accounts

• Two accounts are created with a user name of root


– These are super user accounts that can do anything
– The initial root account passwords are blank

– On Windows
• One root account is for connecting from the local host
• The other allows connections from any host
<Insert Picture Here>

MySQL: Tools
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
Workbench includes Windows GUI

• Platform Native <Insert Picture Here>

– C Core
– Coco, GTK, Win GUI elements as appropriate
• MySQL Native
– Supports all parameters and features of the current and
development server versions
• Native Connections
– TCP/IP
– Sockets / Named Pipes
– SSH
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
Connecting from UIs

Hint
Connection Name – its just a label – nothing technical
Connection Methods – TCP/IP is typical
Schema == Database
<Insert Picture Here>

MySQL: Connectors
Connector/ODBC

• ODBC will let you use MySQL as a database and thus


via MS Office products like Access or Excel

Download the ODBC driver.


http://dev.mysql.com/downloads/connector/odbc/5.1.html#win32

• Run the installer


• Select Complete to get the driver and documentation
Step 1

Go to Control Panel,
Administrative Tools.
Run Data Sources (ODBC)

Click Add…,
Select the MySQL ODBC 5.1 Driver,
and Finish
Step 2
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#.
Connector/NET Resources

Visual Studio integration


http://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 Environment


http://dev.mysql.com/tech-resources/articles/dotnet/index.html

Using MySQL With .NET/C#/Visual Basic/Powershell.


http://dev.mysql.com/usingmysql/dotnet/
Connector/NET Very Simple C# Example

1. Create project

2. Add MySQL Reference


Connector/NET Very Simple C# Example

3b. Main and Declarations


3. Code
namespace ConsoleApplication1
{
3a. Using class Program
{
static void Main(string[] args)
using System;
using System.Data; {
using MySql.Data.MySqlClient; DataSet myData = new DataSet();
using System.IO; MySql.Data.MySqlClient.MySqlConnection conn;
using System.Text; 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 = new
MySql.Data.MySqlClient.MySqlDataAdapter();
conn.ConnectionString = "server=127.0.0.1;uid=youruser;" +
"pwd=yourpassword;database=sakila;";
try
{
cmd.CommandText = "select * from actor";
cmd.Connection = conn;
3c. Connect and Run myAdapter.SelectCommand = cmd;
commands myAdapter.Fill(myData);
myData.WriteXml(@"C:\dataset.xml", XmlWriteMode.WriteSchema);
Change UID and Password }

Uses Sakila DB
catch (MySql.Data.MySqlClient.MySqlException ex)
{
TextWriter errorWriter = Console.Error;
errorWriter.WriteLine("MySQL Exception - " +
3d. Handle Errors ex.Message);
}
}
}
}
<Insert Picture Here>

Windows on MySQL
High Availability and Fault Tolerance
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
Windows Cluster

• High-availability for applications, services and data.


• According to Microsoft…

“When services are down or fail, business continuity is


interrupted, which can result in significant losses. Windows
Server 2008 R2 supports many key high-availability features to
help”

• 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
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/
Other Resources

Deliver MySQL-related
information such as product
release, seminars, webinars,
technical document.

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

Tweet the latest MySQL


information.

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


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
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:
– MySQL-Sales_jp@Oracle.COM

• Online Contact form:


– http://www.mysql.com/about/contact/
<Insert Picture Here>

Thanks for attending!

Você também pode gostar