Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mysql

For beginners

Related Books

Free with a 30 day trial from Scribd

See all
  • Login to see the comments

  • Be the first to like this

Mysql

  1. 1. MySQL Tutorial By: John Bouchard II Bruce Harris
  2. 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. 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%bin;%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:mysqlbin> mysqld --install //installs the service </li></ul><ul><li>C:mysqlbin> NET START MYSQL //start the mysql server </li></ul>
  4. 4. Connecting to the MySQL Server <ul><li>SYNTAX: mysql -h host -u user -p </li></ul><ul><li><< EXAMPLE >> </li></ul><ul><li>C:mysqlbin> mysql –h localhost –u root –p </li></ul><ul><li>NOTE: THE DEFAULT PASSWORD FOR ROOT IS BLANK !!! </li></ul>
  5. 5. Changing “ROOT” password <ul><li> GET USER FIRST: </li></ul><ul><li>C:mysqlbin> mysql -u root mysql </li></ul><ul><li> CHANGE PASSWORD SYNTAX: </li></ul><ul><li>mysql> UPDATE user SET Password=PASSWORD('new_password') </li></ul><ul><li>WHERE user='root'; </li></ul><ul><li>mysql> FLUSH PRIVILEGES; </li></ul><ul><li>DON NOT FORGET THE “ ; “ semi-colon </li></ul>
  6. 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. 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. 8. Hack the GUI on your own time!
  9. 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. 10. Interfacing with Java: Example Code

×