My sql essentials
Upcoming SlideShare
Loading in...5
×
 

My sql essentials

on

  • 197 views

 

Statistics

Views

Total Views
197
Views on SlideShare
197
Embed Views
0

Actions

Likes
0
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

My sql essentials My sql essentials Presentation Transcript

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