MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements...
Transcript of MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements...
![Page 1: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/1.jpg)
MySQL IntroductionEECS 746
Summer 2007
![Page 2: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/2.jpg)
OverviewRequirementsInstallationUsage
![Page 3: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/3.jpg)
Benefits of MySQLFreeFastStablePopularCross platform
![Page 4: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/4.jpg)
Requirements [1/2]Processor - Pentium ||| 733 MHz or higherMemory - 128 MB RAM or moreDisk space - 270 MB or more
![Page 5: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/5.jpg)
Requirements [2/2]Administrator rightsTCP/IP protocol supportDrivers (ODBC, .NET, Visual Studio, PHP ...)
http://dev.mysql.com/doc/refman/5.0/en/connectors.html
![Page 6: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/6.jpg)
Versions6.0 - Alpha5.1 - Beta5.0 - Stable (Recommended)4.1 - Stable
![Page 7: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/7.jpg)
Supported OSWindowsWindows x64Linux (Red Hat, SuSE, Ubuntu, etc.)Mac OS X
http://dev.mysql.com/downloads/mysql/
![Page 8: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/8.jpg)
GUI ToolsMySQL Administrator 1.2MySQL Query Browser 1.2
http://dev.mysql.com/downloads/gui-tools/
Navicat administration and development toolhttp://www.navicat.com/download.html
![Page 9: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/9.jpg)
Installation [1/9]
![Page 10: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/10.jpg)
Installation [2/9]
![Page 11: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/11.jpg)
Installation [3/9]
![Page 12: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/12.jpg)
Installation [4/9]
![Page 13: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/13.jpg)
Installation [5/9]
![Page 14: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/14.jpg)
Installation [6/9]
![Page 15: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/15.jpg)
Installation [7/9]
![Page 16: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/16.jpg)
Installation* [8/9]
![Page 17: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/17.jpg)
Installation [9/9]
![Page 18: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/18.jpg)
Usage [1/3]
![Page 19: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/19.jpg)
Usage [2/3]
![Page 20: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/20.jpg)
Usage [3/3]
![Page 21: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/21.jpg)
OperatorsControl Flow FunctionsString FunctionsNumeric FunctionsDate and Time FunctionsAggregate Functions
http://dev.mysql.com/doc/refman/5.0/en/functions.html
http://www.ilovejackdaniels.com/mysql_cheat_sheet.png
MySQL Functions
![Page 22: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/22.jpg)
PHP Example<?php$link=mysql_connect('localhost', 'mysql_user', 'mysql_password');
mysql_select_db('my_database');
$query='SELECT * FROM my_table';$result=mysql_query($query);
echo "<table>\n";while ($line=mysql_fetch_array($result, MYSQL_ASSOC)){ echo "\t<tr>\n"; foreach ($line as $col_value)
echo "\t\t<td>$col_value</td>\n"; echo "\t</tr>\n";}echo "</table>\n";
mysql_free_result($result);
mysql_close($link);
![Page 23: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/23.jpg)
ASP.NET Example<%@ Page Language="C#" %><%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.Odbc" %><script runat="server">
private const string ConnStr="Driver={MySQL ODBC 3.51 Driver};" +"Server=localhost;Database=my_database;uid=mysql_user;pwd=mysql_password;option=3";protected override void OnInit(EventArgs e){
base.OnInit(e);using(OdbcConnection con=new OdbcConnection(ConnStr))using(OdbcCommand cmd=new OdbcCommand("SELECT * FROM my_table", con)){
con.Open();my_data_source.DataSource=cmd.ExecuteReader(CommandBehavior.CloseConnection | CommandBehavior.SingleResult);my_data_source.DataBind();
}}
</script>
<asp:DataGrid ID="my_data_source" HorizontalAlign="Center" CellPadding="3" Runat="server" />
![Page 24: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/24.jpg)
Java Exampleimport java.sql.*;
public class j_example{
public static void main(String args[]){
String url="jdbc:mysql://localhost:3306/my_database";Connection con=DriverManager.getConnection(url, "mysql_user", "mysql_password");
Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("SELECT * FROM my_table");
while(rs.next()) {
String str=rs.getString("my_column"); System.out.println(str);}
con.close();}
}
![Page 25: MySQL Introduction - University of Kansashossein/Teaching/Su09/Lectures/my-sql-intro.pdfRequirements [1/2] Processor - Pentium ||| 733 MHz or higher Memory - 128 MB RAM or more Disk](https://reader034.fdocuments.us/reader034/viewer/2022050506/5f979edd48166953500228e3/html5/thumbnails/25.jpg)