Your SlideShare is downloading. ×
0
ppt
ppt
ppt
ppt
ppt
ppt
ppt
ppt
ppt
ppt
ppt
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

ppt

954

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
954
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
25
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. MySQL Tutorial By: John Bouchard II Bruce Harris
  • 2. Installing MySQL <ul><li> Download MySQL 4.0.17 at: </li></ul><ul><li>http://www.mysql.com/get/Downloads/MySQL-4.0/mysql-4.0.17-win.zip/from/http://mysql.orst.edu/ </li></ul><ul><li>Unzip “mysql-4.0.1-win.zip” and execute “setup.exe” </li></ul><ul><li> Choose a directory, select typical install options. </li></ul>
  • 3. <ul><li>Once installation is complete, go to your autoexec.bat file </li></ul><ul><li>and put: SET MYSQL_HOME=C:mysql </li></ul><ul><li>SET PATH =%MYSQL_HOME%in;%PATH% </li></ul><ul><li>-where “C:mysql” is the location where you installed mysql. </li></ul><ul><li>Once mysql is installed, and your variables are setup, </li></ul><ul><li>you need to install the mysql server “service”. To do this type: </li></ul><ul><li>C:mysqlin&gt; mysqld --install //installs the service </li></ul><ul><li>C:mysqlin&gt; NET START MYSQL //start the mysql server </li></ul>
  • 4. Connecting to the MySQL Server <ul><li>SYNTAX: mysql -h host -u user -p </li></ul><ul><li>&lt;&lt; EXAMPLE &gt;&gt; </li></ul><ul><li>C:mysqlin&gt; mysql –h localhost –u root –p </li></ul><ul><li>NOTE: THE DEFAULT PASSWORD FOR ROOT IS BLANK !!! </li></ul>
  • 5. Changing “ROOT” password <ul><li> GET USER FIRST: </li></ul><ul><li>C:mysqlin&gt; mysql -u root mysql </li></ul><ul><li> CHANGE PASSWORD SYNTAX: </li></ul><ul><li>mysql&gt; UPDATE user SET Password=PASSWORD(&apos;new_password&apos;) </li></ul><ul><li>WHERE user=&apos;root&apos;; </li></ul><ul><li>mysql&gt; FLUSH PRIVILEGES; </li></ul><ul><li>DON NOT FORGET THE “ ; “ semi-colon </li></ul>
  • 6. Interfacing with MySQL Server <ul><li>The command-line is too cumbersome, we need a GUI!! </li></ul><ul><li>Enter the MySQL Control Center </li></ul><ul><li>Download at: http://www.mysql.com/get/Downloads/MySQLCC/mysqlcc-0.9.4-win32.zip/from/http://mysql.orst.edu/ </li></ul><ul><li>Unzip mysqlcc-0.9.4-win32.zip and install: </li></ul>
  • 7. <ul><li>Open Control Center and Register your MySQL Server </li></ul><ul><li>NAME: Any name you want </li></ul><ul><li>HOST: DNS NAME OR IP-ADDRESS of MySQL SERVER </li></ul><ul><li>USERNAME: Usually root </li></ul><ul><li>PASSWORD: Leave blank, UNLESS you changed it. </li></ul>
  • 8. Hack the GUI on your own time!
  • 9. Interfacing with Java: Important Points <ul><li>Use ConnectorJ “JDBC Driver” </li></ul><ul><li>Include mysql-connector-java-3.0.10-stable-bin.jar in your java project </li></ul><ul><li>Import com.mysql.jdbc.Driver; </li></ul><ul><li>Get to know the java.sql.* Package! </li></ul><ul><li>Understand “DriverManager” and its relationship with a “Connection”. </li></ul><ul><li>OTHER CLASSES OF USE: </li></ul><ul><li>ResultSet - The format Data is retrieved from a Database. </li></ul><ul><li>Statement - Used to query a Database for a ResultSet. </li></ul><ul><li>CallStatement - Execute a StoredProcedure in the database to </li></ul><ul><li>obtain a ResultSet. </li></ul>
  • 10. Interfacing with Java: Example Code
  • 11. &nbsp;

×